iris icon indicating copy to clipboard operation
iris copied to clipboard

[FEATURE REQUEST] Problem Case without Type and wrap errors that are usable with erros.Is(...)

Open Dexus opened this issue 1 year ago • 1 comments

Sample:


_, err := os.ReadFile("/tmp/dat_not_found")
newProblem := iris.NewProblem().Wrap(err)

ctx.StopWithProblem(
    iris.StatusInternalError,
    iris.NewProblem().
        Key("error", true).
        Key("success", false).
        Title("Request failed").
        Detail("Processing did not finish").
        Cause(newProblem),
)
				

Maybe a Wrap thet will be output and one SilentWrap that is only for internal use.

Ref: https://github.com/mschneider82/problem/tree/master

Dexus avatar Sep 10 '24 09:09 Dexus

Hello @Dexus, we can add a wrap method there. However, for your knowledge, I have redesigned the whole http errors idea in the upcoming version, you will be impressed by the innovation putted there!

kataras avatar Sep 10 '24 09:09 kataras