mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-11 20:05:25 +00:00
return generic unexpected service error in sew
This commit is contained in:
parent
efecb622df
commit
5233336ef2
1 changed files with 2 additions and 6 deletions
|
|
@ -38,8 +38,8 @@ const auditService = getAuditService();
|
||||||
/**
|
/**
|
||||||
* "Service Error Wrapper".
|
* "Service Error Wrapper".
|
||||||
*
|
*
|
||||||
* Captures any thrown exceptions and converts them to a unexpected
|
* Captures any thrown exceptions, logs them to the console and Sentry,
|
||||||
* service error. Also logs them with Sentry.
|
* and returns a generic unexpected service error.
|
||||||
*/
|
*/
|
||||||
export const sew = async <T>(fn: () => Promise<T>): Promise<T | ServiceError> => {
|
export const sew = async <T>(fn: () => Promise<T>): Promise<T | ServiceError> => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -52,10 +52,6 @@ export const sew = async <T>(fn: () => Promise<T>): Promise<T | ServiceError> =>
|
||||||
return e.serviceError;
|
return e.serviceError;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e instanceof Error) {
|
|
||||||
return unexpectedError(e.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return unexpectedError(`An unexpected error occurred. Please try again later.`);
|
return unexpectedError(`An unexpected error occurred. Please try again later.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue