Skip to content

MVP support for idiomatic errors

This PR implements support for idiomatic errors as discussed as part of #159. Fixes #143. Supersedes !181 (closed) and !183 (closed).

Design

Enumerations can be marked as enum_error: yes in configuration files. This tells stechec to treat the first variant of the enum as success ("OK") and all other variants as errors.

Marking an enum as an error changes its representation depending on the language:

  • in Rust: Result<(), Error>
  • in Haskell: Either () Error
  • in OCaml: (unit, error) result
  • in all other languages, the representation is unchanged compared to a regular enum
Edited by Léo Lanteri Thauvin

Merge request reports

Loading