errors
errors copied to clipboard
[question] Is there a way to get msg from errors.Wrap(code, msg)?
Hi, I have a question for the project.
Now there is a line of code :
func A() error{
return errors.Wrap(code, msg)
}
Then I have a caller err := A(), so can I use the returned err to get msg?
Thanks in advance.
Not really. This was a deliberate choice to avoid using the string form of an error to transmit context between locations in the call stack
On 2 Aug 2018, at 02:38, Allen Sun [email protected] wrote:
Hi, I have a question for the project.
Now there is a line of code :
func A() error{ return errors.Wrap(code, msg) } Then I have a caller err := A(), so can I use the returned err to get msg?
Thanks in advance.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
I want to set error code,and use it in the caller too