-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Before sending to Sentry check if the error is a known chain error
- Loading branch information
1 parent
861414b
commit 23afd49
Showing
5 changed files
with
34 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { RunErrorCodes } from '../../constants' | ||
import { isChainError } from '../../services/chains/ChainStreamConsumer' | ||
|
||
/** | ||
* We only throw an error if is not a known run error. | ||
* | ||
* 1. Is a ChainError of type `unknown`. This is the catch in `runChain` not knowing what happened. | ||
* 2. is not a `ChainError` so it means something exploded. | ||
*/ | ||
export function getUnknownError(error: Error | unknown | undefined) { | ||
const isAllGood = | ||
!error || (isChainError(error) && error.errorCode !== RunErrorCodes.Unknown) | ||
|
||
if (isAllGood) return null | ||
|
||
return error as Error | ||
} |