You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am frequently using NewNotFound() and NewBadRequest() in my model logic so that the receiving controller knows about the type of error using an if-statement with errors.Is(err, errors.NotFound) for example.
I just realized now that errors which were wrapped with NewNotFound() somehow have no file, line and function recorded which makes it harder to find the error location.
Here is an example:
err:=errors.New("my error")
err=errors.NewNotFound(err, "first context")
println(errors.ErrorStack(err))
// returns the following which lacks the file, line and function
first context: myerror
Am I using it wrong?
The text was updated successfully, but these errors were encountered:
Hi,
I am frequently using
NewNotFound()
andNewBadRequest()
in my model logic so that the receiving controller knows about the type of error using an if-statement witherrors.Is(err, errors.NotFound)
for example.I just realized now that errors which were wrapped with
NewNotFound()
somehow have no file, line and function recorded which makes it harder to find the error location.Here is an example:
Am I using it wrong?
The text was updated successfully, but these errors were encountered: