Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SdkError ¶
type SdkError struct {
Code string `json:"code"`
Trace []string `json:"trace"`
Msg string `json:"msg"`
Cause *string `json:"cause,omitempty"`
Args map[string]any `json:"args,omitempty"`
}
SdkError is a struct that implements the Go error interface.
func Error ¶
Error tries to cast the cause as an SdkError, if it is not an SdkError, it creates a new SdkError with the given parameters. It logs the error message and returns the error. If cause is nil, it will store a blank string in the Cause field. The field Code is a hash of the message and trace. It is used to identify the recurrence of an error. Params: msg: the error message. cause: the error that caused this error. args: a map of additional information. Returns: *SdkError: the error. This type implements the Go error interface.
func ToSdkError ¶
ToSdkError tries to cast an error to a SdkError. If the error isn't an SdkError, it returns nil.