mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-06 13:22:58 +00:00
Allow type to be missing. (#652)
This commit is contained in:
2
changelogs/fragments/652-problem-type.yml
Normal file
2
changelogs/fragments/652-problem-type.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- "acme_* modules - correctly handle error documents without ``type`` (https://github.com/ansible-collections/community.crypto/issues/651, https://github.com/ansible-collections/community.crypto/pull/652)."
|
||||
@@ -21,13 +21,14 @@ def format_http_status(status_code):
|
||||
|
||||
|
||||
def format_error_problem(problem, subproblem_prefix=''):
|
||||
error_type = problem.get('type', 'about:blank') # https://www.rfc-editor.org/rfc/rfc7807#section-3.1
|
||||
if 'title' in problem:
|
||||
msg = 'Error "{title}" ({type})'.format(
|
||||
type=problem['type'],
|
||||
type=error_type,
|
||||
title=problem['title'],
|
||||
)
|
||||
else:
|
||||
msg = 'Error {type}'.format(type=problem['type'])
|
||||
msg = 'Error {type}'.format(type=error_type)
|
||||
if 'detail' in problem:
|
||||
msg += ': "{detail}"'.format(detail=problem['detail'])
|
||||
subproblems = problem.get('subproblems')
|
||||
|
||||
Reference in New Issue
Block a user