github.com/blend/go-sdk@v1.20240719.1/statsd/errors.go (about)

     1  /*
     2  
     3  Copyright (c) 2024 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package statsd
     9  
    10  import "net"
    11  
    12  // IsErrUseOfClosedNetworkConnection is an error class checker.
    13  func IsErrUseOfClosedNetworkConnection(err error) bool {
    14  	if err == nil {
    15  		return false
    16  	}
    17  	typed, ok := err.(*net.OpError)
    18  	if !ok {
    19  		return false
    20  	}
    21  	if typed.Temporary() || typed.Timeout() {
    22  		return false
    23  	}
    24  	return typed.Err.Error() == "use of closed network connection"
    25  }