Skip to content

Commit

Permalink
add new known errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis-tra committed Nov 20, 2023
1 parent 3c1e35e commit 7a2d780
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
12 changes: 10 additions & 2 deletions pkg/db/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,27 @@ import (
var KnownErrors = map[string]string{
"i/o timeout": models.NetErrorIoTimeout,
"RPC timeout": models.NetErrorIoTimeout,
"no recent network activity": models.NetErrorNoRecentNetworkActivity,
"no recent network activity": models.NetErrorIoTimeout, // formerly NetErrorNoRecentNetworkActivity (equivalent to a timeout)
"connection refused": models.NetErrorConnectionRefused,
"connection reset by peer": models.NetErrorConnectionResetByPeer,
"protocol not supported": models.NetErrorProtocolNotSupported,
"protocols not supported": models.NetErrorProtocolNotSupported,
"peer id mismatch": models.NetErrorPeerIDMismatch,
"peer IDs don't match": models.NetErrorPeerIDMismatch,
"no route to host": models.NetErrorNoRouteToHost,
"network is unreachable": models.NetErrorNetworkUnreachable,
"no good addresses": models.NetErrorNoGoodAddresses,
"context deadline exceeded": models.NetErrorIoTimeout, // formerly NetErrorContextDeadlineExceeded
"no public IP address": models.NetErrorNoPublicIP,
"no public IP address": models.NetErrorNoIPAddress,
"max dial attempts exceeded": models.NetErrorMaxDialAttemptsExceeded,
"host is down": models.NetErrorHostIsDown,
"stream reset": models.NetErrorStreamReset,
"failed to negotiate security protocol: EOF": models.NetErrorNegotiateSecurityProtocol, // connect retry logic in discv5 relies on the ": EOF" suffix.
"failed to negotiate stream multiplexer": models.NetErrorNegotiateStreamMultiplexer,
"resource limit exceeded": models.NetErrorResourceLimitExceeded,
"Write on stream": models.NetErrorWriteOnStream,
"can't assign requested address": models.NetErrorCantAssignRequestedAddress, // transient error
"connection gated": models.NetErrorConnectionGated, // transient error
}

var ErrorStr = map[string]string{}
Expand All @@ -48,10 +52,14 @@ var knownErrorsPrecedence = []string{
"i/o timeout",
"RPC timeout",
"no recent network activity",
"can't assign requested address",
"connection gated",
"connection refused",
"connection reset by peer",
"protocol not supported",
"protocols not supported",
"peer id mismatch",
"peer IDs don't match",
"no route to host",
"network is unreachable",
"no good addresses",
Expand Down
2 changes: 1 addition & 1 deletion pkg/db/migrations/000026_add_net_errors.down.sql
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-- no down migration :/
-- no down migration
9 changes: 8 additions & 1 deletion pkg/db/migrations/000026_add_net_errors.up.sql
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
ALTER TYPE net_error ADD VALUE 'connection_reset_by_peer';
BEGIN;

ALTER TYPE net_error ADD VALUE 'connection_reset_by_peer';
ALTER TYPE net_error ADD VALUE 'cant_assign_requested_address';
ALTER TYPE net_error ADD VALUE 'connection_gated';
ALTER TYPE net_error RENAME VALUE 'no_public_ip' TO 'no_ip_address';

COMMIT
8 changes: 6 additions & 2 deletions pkg/models/boil_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7a2d780

Please sign in to comment.