Grokking Advanced Go
0% completed
Wrapping Errors
A customer reports that checkout failed for order 1001. The log holds one line for that request: connection refused. The service calls a database, a payment provider, and a warehouse, so the line does not say which call failed or which order it served.
The function that made the network call reported an accurate fact, but it knew nothing about orders. Each of its callers returned the error unchanged, so the order ID and the name of the step never appeared in the log.
How can each function add what it knows to an error, while the original error stays available to its callers?
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%