github.com/Ingenico-ePayments/connect-sdk-go@v0.0.0-20240318153750-1f8cd329b9c9/errors/CommunicationError.go (about)

     1  package errors
     2  
     3  // CommunicationError represents an error during the communication with the Ingenico ePayments platform
     4  type CommunicationError struct {
     5  	internalError error
     6  }
     7  
     8  // InternalError returns the internal error encountered
     9  func (ce *CommunicationError) InternalError() error {
    10  	return ce.internalError
    11  }
    12  
    13  // Error implements the Error interface
    14  func (ce *CommunicationError) Error() string {
    15  	return ce.String()
    16  }
    17  
    18  // String implements the Stringer interface
    19  // Format: 'There was an error in the communication with the Ingenico ePayments platform error'
    20  func (ce *CommunicationError) String() string {
    21  	return "There was an error in the communication with the Ingenico ePayments platform " + ce.internalError.Error()
    22  }
    23  
    24  // NewCommunicationError creates a Communication with the given internal error
    25  func NewCommunicationError(internalError error) (*CommunicationError, error) {
    26  	return &CommunicationError{internalError}, nil
    27  }