Log better errors when unable to show attachments

This commit is contained in:
Josh Perez 2022-04-29 14:48:26 -04:00 committed by GitHub
parent 6e7092c294
commit 4090e968b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View file

@ -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);
}