Semantics of `@error`

In doctest and CitationBibliography · Issue #34 · JuliaDocs/DocumenterCitations.jl · GitHub, the question came up what the semantics of the @error macro should be. Specifically, whether execution should continue after an @error message.

Personally, I’ve been using the following mental model:

  • error(msg): Fatal error, execution cannot continue
  • @warn msg: There’s something that needs the user’s attention (but it might be ok)
  • @error msg: There’s something wrong. We can keep running, but the user is definitely not getting the result they’re expecting.

That is, @error doesn’t necessarily have to be fatal — although it can be: I’ve also used @error to give additional context immediately before a call to error.

Is there a general consensus in the community as to what the appropriate semantics of @error and @warn are?

@error is non-fatal. It just means log a message with error severity. Your application may recover or you may want to terminate execution afterwards. But @error, @warn etc are log-statements nothing more or less :slight_smile:

3 Likes