fix(housekeeping): preserve error correlation IDs
This commit is contained in:
1 parent
b7edbca043
commit
cc6bb9a9a3
2 files changed
+32
-9
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import { createCorrelationId } from "../correlation";
|
||||
|
||||
export type HousekeepingErrorCode =
|
||||
| "UNAUTHENTICATED"
|
||||
| "FORBIDDEN"
|
||||
@@ -40,9 +42,9 @@ export function fail(
|
||||
};
|
||||
}
|
||||
|
||||
export function mapUnknownError(_error: unknown): HousekeepingError {
|
||||
return {
|
||||
code: "INTERNAL",
|
||||
messageKey: "errors.housekeeping.internal",
|
||||
};
|
||||
export function mapUnknownError(
|
||||
_error: unknown,
|
||||
correlationId = createCorrelationId(),
|
||||
): HousekeepingResult<never> {
|
||||
return fail("INTERNAL", "errors.housekeeping.internal", correlationId);
|
||||
}
|
||||
Reference in new issue
Block a user