add health util for error catching

This commit is contained in:
Lucy Cifferello
2022-11-15 11:59:44 -05:00
parent 7e2770a8e1
commit 441582a14d

View File

@@ -35,3 +35,9 @@ export const guardDurationAboveMinimum = (
(input.duration <= input.minimumTime)
? Promise.reject(errorCode(60, "Starting"))
: null;
export const catchError = (effects: Effects) => (e: unknown) => {
const error = (error: string) => ({ error });
effects.error(`Health check failed: ${e}`);
return error("Error while running health check");
};