Documentation
¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( SuccessCode int64 = 0 InvalidSignatureCode int64 = 1 InvalidTaxID int64 = 3 ApprovalRequired int64 = 4 UnhandledException int64 = 5 InvalidSerial int64 = 6 InvalidClientHeader int64 = 7 InvalidCertificate int64 = 8 )
View Source
const ( SuccessMessage = "Success" InvalidSignatureMsg = "Invalid Signature. Signature generated not in correct format or" + " Signature generated with missing nodes or signature generated with empty lines in XML." InvalidTaxIDMsg = "Invalid TIN. TIN specified with dash or wrong TIN specified." ApprovalRequiredMsg = "VFD Registration Approval required. Request posted without Client details, which is WEBAPI." UnhandledExceptionMsg = "Unhandled Exception. Contact TRA for further troubleshooting." InvalidSerialMsg = "Invalid Serial or Serial not Registered to Web API/TIN." + " CERTKEY is not registered to TIN sending registration request. Use only TIN and CERTKEY provided by TRA." InvalidClientHeaderMsg = "Invalid client header. Wrong client value specified." InvalidCertificateMsg = "Wrong Certificate used to Register Web API. Wrong certificate used." )
Variables ¶
This section is empty.
Functions ¶
func CheckNetworkError ¶
CheckNetworkError checks if the errors is about network and returns a NetworkError. An errors are considered a network error if it is a net.Error, context.Canceled or context.DeadlineExceeded. or just a context error.
Example ¶
err := &NetworkError{
Err: fmt.Errorf("failed to connect to server"),
Message: "failed to connect to server",
}
errFinal := CheckNetworkError(context.Background(), "test", err)
fmt.Println(errFinal)
Output: test: failed to connect to server: failed to connect to server
func ParseErrorCode ¶
ParseErrorCode parses the error code and returns the corresponding error message.
Types ¶
type Error ¶
type NetworkError ¶
NetworkError is returned when there is an error in the network.
func (*NetworkError) Error ¶
func (e *NetworkError) Error() string
func (*NetworkError) Unwrap ¶
func (e *NetworkError) Unwrap() error
Unwrap returns the underlying error.
Click to show internal directories.
Click to hide internal directories.