Log better errors when unable to show attachments
This commit is contained in:
parent
6e7092c294
commit
4090e968b6
3 changed files with 22 additions and 1 deletions
|
@ -3,11 +3,17 @@
|
|||
|
||||
/* eslint-disable max-classes-per-file */
|
||||
|
||||
import { get, has } from 'lodash';
|
||||
|
||||
export function toLogFormat(error: unknown): string {
|
||||
if (error instanceof Error && error.stack) {
|
||||
return error.stack;
|
||||
}
|
||||
|
||||
if (has(error, 'message')) {
|
||||
return get(error, 'message');
|
||||
}
|
||||
|
||||
return String(error);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue