logoalt Hacker News

YmiYugyyesterday at 11:30 PM2 repliesview on HN

What is the context that the Go code adds here? When File::create or os.Create fails the errors they return already contain the information what and why something failed. So what information does "failed to create file: " add?


Replies

Mawrtoday at 3:51 AM

Whatever context you deem appropriate at the time of writing that message. Don't overfocus on the example. It could be the request ID, the customer's name — anything that's relevant to that particular call.

edflsafoiewqyesterday at 11:34 PM

The error from Rust's File::create basically only contains the errno result. So it's eg. "permission denied" vs "failed to create file: permission denied".