-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Description
Hi,
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: my errorAm I using it wrong?
Metadata
Metadata
Assignees
Labels
No labels