Wrapf
Wraps a root cause error with another. This is useful to unify an error type in a package.
def Wrapf(
code: ErrorCode,
cause: error,
msgFmt: string,
args: ...interface{}
) - > error
Wraps a root cause error with another. This is useful to unify an error type in a package.
Parameters
| Name | Type | Description |
|---|---|---|
| code | ErrorCode | The specific error code to associate with the new error, providing categorization for the error. |
| cause | error | The underlying root cause error that is being wrapped, allowing for error chaining and inspection of the original problem. |
| msgFmt | string | The format string for the new error message, similar to fmt.Sprintf, used to construct a descriptive message. |
| args | ...interface{} | Arguments to be interpolated into the msgFmt string, providing dynamic content for the error message. |
Returns
| Type | Description |
|---|---|
error | A new error that wraps the original cause error, including a specified error code and formatted message. |