Go Raw Errors and Well-Formed Errors: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
=External=
* Concurrency in Go by Katherine Cox-Buday, Chapter 5. Concurrency At Scale, Error Propagation
=Internal=
=Internal=
* [[Go_Language_Error_Handling#Raw_Errors_and_Well-Formed_Errors|Go Error Handling]]
* [[Go_Language_Error_Handling#Raw_Errors_and_Well-Formed_Errors|Go Error Handling]]
=Overview=
=Overview=
This error handling pattern is built around the fact that all errors belong to one of two categories: bugs and known edge cases (disk full, network failure, etc.).  
This error handling pattern is built around the fact that all errors belong to one of two categories: bugs and known edge cases (disk full, network failure, etc.).  


The pattern requires to represent the known edge cases as "well-formed" errors and declare them as part of our component API. When exported, errors become part of your package's public API and must be treated with as much care as you would any other part of your public API.
The pattern requires to represent the known edge cases as "well-formed" errors and declare them as part of our component API. When exported, errors become part of your package's public API and must be treated with as much care as you would any other part of your public API. All other errors are "raw errors" and represent bugs.
 
All other errors are "raw errors" and represent bugs.
 
=a=
=b=

Revision as of 23:47, 12 February 2024

External

  • Concurrency in Go by Katherine Cox-Buday, Chapter 5. Concurrency At Scale, Error Propagation

Internal

Overview

This error handling pattern is built around the fact that all errors belong to one of two categories: bugs and known edge cases (disk full, network failure, etc.).

The pattern requires to represent the known edge cases as "well-formed" errors and declare them as part of our component API. When exported, errors become part of your package's public API and must be treated with as much care as you would any other part of your public API. All other errors are "raw errors" and represent bugs.