-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop sending non-actionable errors to incident.io
- Loading branch information
1 parent
1305dec
commit 47a1f9d
Showing
3 changed files
with
39 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package shared | ||
|
||
type ErrType string | ||
|
||
const ( | ||
ErrTypeCanceled ErrType = "err:Canceled" | ||
ErrTypeClosed ErrType = "err:Closed" | ||
ErrTypeNet ErrType = "err:Net" | ||
ErrTypeEOF ErrType = "err:EOF" | ||
) | ||
|
||
func SkipSendingToIncidentIo(errTags []string) bool { | ||
skipTags := map[string]struct{}{ | ||
string(ErrTypeCanceled): {}, | ||
string(ErrTypeClosed): {}, | ||
string(ErrTypeNet): {}, | ||
} | ||
for _, tag := range errTags { | ||
if _, ok := skipTags[tag]; ok { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
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