Signal-Desktop/ts/types/errors.ts

19 lines
401 B
TypeScript
Raw Permalink Normal View History

2022-06-03 21:07:51 +00:00
// Copyright 2018-2022 Signal Messenger, LLC
2021-07-14 23:39:52 +00:00
// SPDX-License-Identifier: AGPL-3.0-only
import { get, has } from 'lodash';
2021-07-14 23:39:52 +00:00
export function toLogFormat(error: unknown): string {
if (error instanceof Error && error.stack) {
return error.stack;
}
if (has(error, 'message')) {
return get(error, 'message');
}
2021-07-14 23:39:52 +00:00
return String(error);
}
2021-09-22 00:58:03 +00:00
2021-09-24 00:49:05 +00:00
export class ProfileDecryptError extends Error {}