wscalls: do not log/notify about app errors anymore (#87554)
gitea/wcs/pipeline/head This commit looks good
Details
gitea/wcs/pipeline/head This commit looks good
Details
This commit is contained in:
parent
3d42d456d9
commit
8c26581924
|
@ -241,12 +241,12 @@ def test_webservice_on_error(http_requests, emails, notify_on_errors, record_on_
|
|||
'500': '500 Internal Server Error',
|
||||
'json-err0': None,
|
||||
'json-err0int': None,
|
||||
'json-err1': 'err: 1',
|
||||
'json-err1int': 'err: 1',
|
||||
'json-err1-with-desc': 'err: 1, err_desc: :(',
|
||||
'json-errstr': 'err: bug',
|
||||
'json-errheader1': 'err: 1',
|
||||
'json-errheaderstr': 'err: bug',
|
||||
'json-err1': None,
|
||||
'json-err1int': None,
|
||||
'json-err1-with-desc': None,
|
||||
'json-errstr': None,
|
||||
'json-errheader1': None,
|
||||
'json-errheaderstr': None,
|
||||
}
|
||||
wscall.request = {'url': 'http://remote.example.net/%s' % url_part}
|
||||
wscall.store()
|
||||
|
|
|
@ -51,6 +51,17 @@ class NamedWsCallUI:
|
|||
)
|
||||
form.add(WsCallRequestWidget, 'request', value=self.wscall.request, title=_('Request'), required=True)
|
||||
|
||||
form.widgets.append(
|
||||
HtmlWidget(
|
||||
'<div class="infonotice"><p>%s</p></div>'
|
||||
% _(
|
||||
'This tab is about connection, payload, and HTTP errors. '
|
||||
'Application errors ("err" property in response different than zero) '
|
||||
'are always silent.'
|
||||
),
|
||||
tab=('error', _('Error Handling')),
|
||||
)
|
||||
)
|
||||
form.add(
|
||||
CheckboxWidget,
|
||||
'notify_on_errors',
|
||||
|
@ -63,6 +74,7 @@ class NamedWsCallUI:
|
|||
'record_on_errors',
|
||||
title=_('Record on errors'),
|
||||
value=self.wscall.record_on_errors if self.wscall.slug else True,
|
||||
default_value=True,
|
||||
tab=('error', _('Error Handling')),
|
||||
)
|
||||
if not self.wscall.is_readonly():
|
||||
|
|
|
@ -565,6 +565,7 @@ class HtmlWidget:
|
|||
self.attrs = {}
|
||||
self.string = string
|
||||
self.title = title
|
||||
self.tab = kwargs.pop('tab', None)
|
||||
|
||||
def render(self):
|
||||
return self.render_content()
|
||||
|
|
|
@ -205,8 +205,8 @@ def call_webservice(
|
|||
)
|
||||
return (None, None, None)
|
||||
|
||||
app_error_code = get_app_error_code(response, data, 'json')
|
||||
if (app_error_code != 0 or status >= 400) and (notify_on_errors or record_on_errors):
|
||||
if status >= 400 and (notify_on_errors or record_on_errors):
|
||||
app_error_code = get_app_error_code(response, data, 'json')
|
||||
record_wscall_error(status, data, response, app_error_code, notify_on_errors, record_on_errors)
|
||||
|
||||
return (response, status, data)
|
||||
|
|
Loading…
Reference in New Issue