morikuni / failure Goto Github PK
View Code? Open in Web Editor NEWfailure is a utility package for handling application errors.
License: MIT License
failure is a utility package for handling application errors.
License: MIT License
This is a feature request for wrapping multiple errors.
go 1.20 supports wrapping multiple errors.
https://tip.golang.org/doc/go1.20#errors
But, failure is a lack of support for wrapping multiple errors.
I want support for wrapping multiple errors.
But, I found you are working on v2.
Would you happen to have any plan for support for wrapping multiple errors on v2?
I wrote current workaround and expected codes below.
err := doSomething(id)
if err != nil {
// Currently, we have to combine `failure.Wrap and fmt.Errorf`
return failure.Wrap(fmt.Errorf("foo bar :%w :%w", err, &MyError{
ID: id
}))
// expected like this
return failure.Wrap(err, failure.Message("foo bar"), failure.WithCause(&MyError{
ID: id
}))
}
I don't understand the difference between the following two usages
msg:="not found"
originalErr:=errors.New(msg)
err:=failure.MarkUnexpected(originalErr)
vs
err:=failure.Unexpected(msg)
Can you give me some examples?
What are the different scenarios in which these two functions are used?
Want to output errors in JSON format.
Plan:
format
sub package type callStacker interface {
GetCallStack() CallStack
}
type contexter interface {
GetContext() Context
}
type messenger interface {
GetMessage() string
}
type coder interface {
GetCode() Code
}
type formatter interface {
IsFormatter()
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.