* Add example app to test credential sync * Fixes * Changes to normalize flow of GoogleCalendar and Zoom * Add unit tests * PR Feedback * credential-sync-more-tests-and-more-apps * Fix yarn.lock * Clear cache * Add test * Fix yarn.lock * Fix 204 handling * Fix yarn.lock --------- Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
16 lines
465 B
TypeScript
16 lines
465 B
TypeScript
/**
|
|
* It stringifies the object which is necessary to ensure that in a logging system(like Axiom) we see the object in context in a single log event
|
|
*/
|
|
export function safeStringify(obj: unknown) {
|
|
try {
|
|
if (obj instanceof Error) {
|
|
// Errors don't serialize well, so we extract what we want
|
|
return obj.stack ?? obj.message;
|
|
}
|
|
// Avoid crashing on circular references
|
|
return JSON.stringify(obj);
|
|
} catch (e) {
|
|
return obj;
|
|
}
|
|
}
|