OK, i think i have it;

basically he root of it was i wasn't thinking properly about how errors 
need/should be implemented as immutable. Unwrap is basically a state 
getter. (no setter for the wrapped error.)

so it seems to me that custom and fmt.Prinf("%w") wrappers have different 
use cases: 

* fmt.Printf(%w) is just to add more text to an error, because errors are 
immutable its needed.(unless you have custom error types and are local to 
them, then you could just edit their state.)

* custom wrapping types, unlike fmt.Printf(%w), create error 'classes' for 
testing against and have utilities to help deal with unknown depths of 
wrapping.

since i was only dealing with one level, i probably should have avoided 
wrapping entirely, but now i know!

this does seem as if its a pattern that might come up elsewhere, so good to 
understand clearly (unless i'm still off about something above).

thanks for help.

-- 
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 on the web visit 
https://groups.google.com/d/msgid/golang-nuts/fa0e1186-c185-4143-9df9-d0ba7aa11826o%40googlegroups.com.

Reply via email to