alwaysai
Version:
The alwaysAI command-line interface (CLI)
14 lines (12 loc) • 331 B
text/typescript
import { serializeError } from 'serialize-error';
export function stringifyError(e: Error) {
let errorStr = '';
if (e.stack !== undefined) {
errorStr = e.stack;
} else if (e.message !== undefined) {
errorStr = e.message;
} else {
errorStr = JSON.stringify(serializeError(e), null, 2);
}
return errorStr;
}