[Question] What is difference between eris.New() and eris.NewGlobal()
0x5487 opened this issue · 1 comments
0x5487 commented
Sorry, I am afraid that I'm not sure when I should use eris.New() or eris.NewGlobal(). What is difference between eris.New() and eris.NewGlobal()? Would you mind providing us more details, please? Thank you
sum2000 commented
The difference is in their usage. Use eris.NewGlobal()
when you have a need to define global/sentinel errors whereas eris.New()
when your error is local to a function. You can take a look at the difference in usage here at ln15 and ln28. Be careful while using the eris.NewGlobal()
inside a method though, as the resulting trace might be incorrect.