[Design] Error model
mratsim opened this issue · 0 comments
mratsim commented
Error model is still to be decided.
Currently asserts are used https://github.com/numforge/laser/blob/be3326bca5d9096e912530c6ed946bb89ee01b6f/laser/strided_iteration/map_foreach.nim#L106-L110
Literature:
- http://joeduffyblog.com/2016/02/07/the-error-model/
- https://github.com/status-im/nimbus/wiki/Exceptions-and-errors
- https://gist.github.com/zah/d2d729b39d95a1dfedf8183ca35043b3
Challenges:
- should the interface exposed be left to higher-level lib? (i.e. leave only asserts as those are removed on release builds)
- If not:
- Distinguish between recoverable and unrecoverable errors (bugs).
- For embedded devices recoverable errors "API" must be documented, whether error code or exceptions are chosen.
- Macros like
forEach
cannot use error codes, high level wrapper should take care of that