debug-log mastodon error responses

This commit is contained in:
Hazelnoot 2025-05-06 17:27:39 -04:00
parent d9d0adbc6f
commit 2aa3cf2731
2 changed files with 19 additions and 8 deletions

View file

@ -65,6 +65,13 @@ export function getErrorData(error: unknown): MastodonError {
return convertGenericError(error);
}
if ('error' in error && typeof(error.error) === 'string') {
// "error_description" is string, undefined, or not present.
if (!('error_description' in error) || typeof(error.error_description) === 'string' || typeof(error.error_description) === 'undefined') {
return error as MastodonError;
}
}
return convertUnknownError(error);
}