mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-10 19:03:12 +00:00
Merge pull request 'fix(logs): Implement json encode error handling' (#570) from naiji/ssh-key-rendering-error into master
Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/pulls/570 Reviewed-by: Inex Code <inex.code@selfprivacy.org>
This commit is contained in:
commit
ef8ca84263
|
@ -101,12 +101,19 @@ class ConsoleInterceptor extends InterceptorsWrapper {
|
|||
) async {
|
||||
final Response? response = err.response;
|
||||
|
||||
String responseEncoded = '';
|
||||
try {
|
||||
responseEncoded = jsonEncode(response);
|
||||
} catch (e) {
|
||||
responseEncoded = response?.statusMessage ?? responseEncoded;
|
||||
}
|
||||
|
||||
addConsoleLog(
|
||||
ManualConsoleLog.warning(
|
||||
customTitle: 'RestAPI error',
|
||||
content: '"uri": "${response?.realUri}",\n'
|
||||
'"status_code": ${response?.statusCode},\n'
|
||||
'"response": ${jsonEncode(response)}',
|
||||
'"response": $responseEncoded',
|
||||
),
|
||||
);
|
||||
return super.onError(err, handler);
|
||||
|
|
Loading…
Reference in a new issue