Hi Uzondo,

Thanks for the comments.

> On Feb 5, 2025, at 3:44 PM, Uzondu Enudeme <willpo...@gmail.com> wrote:
> On the naming I also thought TraceError could be called StackError so that 
> NewStackError would return *StackError. 
> Maybe we can just rename it to be NewTraceError() since it returns 
> *TraceError. 

Dammit, that was a refactoring "bug" that I did not catch before posting.  

Here it is "fixed": https://go.dev/play/p/-FOdRQFQobQ 
<https://go.dev/play/p/-FOdRQFQobQ>

> One observation is that the implementation of NewStackError also accepted a 
> variadic parameter for wrapped errors but only used the first one. A small 
> update could be to use errors.Join(wrapped...) to capture all passed in 
> errors. 
> This is useful when using expressions like `errors.Is`, only the first error 
> is found in the tree even when multiple errors are passed in. Any exposed API 
> is most likely to be depended upon even when the designer didn't plan for it 
> to be used.

Interesting idea. Want to tackle that refactor and then post an updated link?

-Mike

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/39104908-744A-4CCC-98B2-224E94583EC5%40newclarity.net.

Reply via email to