Re:Error stack traces in Go with x/xerror
by konart on Wednesday August 25, 2021 @10:01AM
(#28301816)
> Eg there are plenty of environmental reasons you’d need to cease execution but giving the user a stack trace isn’t helpful.
Not sure I got this part. If you want to stop the program and don't to print the usual panic messages into the console - you can log\print whatever you want and call os.Exit().
At the same time you can log stack trace without panicing.
>Or at least I think it does.
Maybe, it's just that "the code has failed and the developer needs to be informed what to fix" applies to errors just a much as to panics. The only difference is that an error is the situation during the execution where you can continue the job and a panic requires execution to stop (in most cases).
At the same time panic are 'developers only'.
Personally my one gripe with Gos errors is that EOF is handled as an error.