@@ -310,6 +310,61 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) {
310310 }
311311 }
312312
313+ // Connection reset errors can mostly be ignored
314+ if errors .Is (err , syscall .ECONNRESET ) {
315+ return ErrorIgnoreConnTemporary , ErrorInfo {
316+ Source : ErrorSourceNet ,
317+ Code : syscall .ECONNRESET .Error (),
318+ }
319+ }
320+
321+ if errors .Is (err , net .ErrClosed ) || strings .HasSuffix (err .Error (), "use of closed network connection" ) {
322+ return ErrorIgnoreConnTemporary , ErrorInfo {
323+ Source : ErrorSourceNet ,
324+ Code : "net.ErrClosed" ,
325+ }
326+ }
327+
328+ var netErr * net.OpError
329+ if errors .As (err , & netErr ) {
330+ return ErrorNotifyConnectivity , ErrorInfo {
331+ Source : ErrorSourceNet ,
332+ Code : netErr .Err .Error (),
333+ }
334+ }
335+
336+ var sshOpenChanErr * ssh.OpenChannelError
337+ if errors .As (err , & sshOpenChanErr ) {
338+ return ErrorNotifyConnectivity , ErrorInfo {
339+ Source : ErrorSourceSSH ,
340+ Code : sshOpenChanErr .Reason .String (),
341+ }
342+ }
343+
344+ var sshTunnelSetupErr * exceptions.SSHTunnelSetupError
345+ if errors .As (err , & sshTunnelSetupErr ) {
346+ return ErrorNotifyConnectivity , ErrorInfo {
347+ Source : ErrorSourceSSH ,
348+ Code : "UNKNOWN" ,
349+ }
350+ }
351+
352+ var dnsErr * net.DNSError
353+ if errors .As (err , & dnsErr ) {
354+ return ErrorNotifyConnectivity , ErrorInfo {
355+ Source : ErrorSourceNet ,
356+ Code : "net.DNSError" ,
357+ }
358+ }
359+
360+ var tlsCertVerificationError * tls.CertificateVerificationError
361+ if errors .As (err , & tlsCertVerificationError ) {
362+ return ErrorNotifyConnectivity , ErrorInfo {
363+ Source : ErrorSourceNet ,
364+ Code : "tls.CertificateVerificationError" ,
365+ }
366+ }
367+
313368 var temporalErr * temporal.ApplicationError
314369 if errors .As (err , & temporalErr ) {
315370 switch exceptions .ApplicationErrorType (temporalErr .Type ()) {
@@ -646,53 +701,6 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) {
646701 return ErrorOther , chErrorInfo
647702 }
648703
649- // Connection reset errors can mostly be ignored
650- if errors .Is (err , syscall .ECONNRESET ) {
651- return ErrorIgnoreConnTemporary , ErrorInfo {
652- Source : ErrorSourceNet ,
653- Code : syscall .ECONNRESET .Error (),
654- }
655- }
656-
657- if errors .Is (err , net .ErrClosed ) || strings .HasSuffix (err .Error (), "use of closed network connection" ) {
658- return ErrorIgnoreConnTemporary , ErrorInfo {
659- Source : ErrorSourceNet ,
660- Code : "net.ErrClosed" ,
661- }
662- }
663-
664- var netErr * net.OpError
665- if errors .As (err , & netErr ) {
666- return ErrorNotifyConnectivity , ErrorInfo {
667- Source : ErrorSourceNet ,
668- Code : netErr .Err .Error (),
669- }
670- }
671-
672- var ssOpenChanErr * ssh.OpenChannelError
673- if errors .As (err , & ssOpenChanErr ) {
674- return ErrorNotifyConnectivity , ErrorInfo {
675- Source : ErrorSourceSSH ,
676- Code : ssOpenChanErr .Reason .String (),
677- }
678- }
679-
680- var sshTunnelSetupErr * exceptions.SSHTunnelSetupError
681- if errors .As (err , & sshTunnelSetupErr ) {
682- return ErrorNotifyConnectivity , ErrorInfo {
683- Source : ErrorSourceSSH ,
684- Code : "UNKNOWN" ,
685- }
686- }
687-
688- var dnsErr * net.DNSError
689- if errors .As (err , & dnsErr ) {
690- return ErrorNotifyConnectivity , ErrorInfo {
691- Source : ErrorSourceNet ,
692- Code : "net.DNSError" ,
693- }
694- }
695-
696704 var peerCreateError * exceptions.PeerCreateError
697705 if errors .As (err , & peerCreateError ) {
698706 // Check for context deadline exceeded error
@@ -716,14 +724,6 @@ func GetErrorClass(ctx context.Context, err error) (ErrorClass, ErrorInfo) {
716724 }
717725 }
718726
719- var tlsCertVerificationError * tls.CertificateVerificationError
720- if errors .As (err , & tlsCertVerificationError ) {
721- return ErrorNotifyConnectivity , ErrorInfo {
722- Source : ErrorSourceNet ,
723- Code : "tls.CertificateVerificationError" ,
724- }
725- }
726-
727727 var numericTruncatedError * exceptions.NumericTruncatedError
728728 if errors .As (err , & numericTruncatedError ) {
729729 return ErrorLossyConversion , ErrorInfo {
0 commit comments