#error

built-in shelf

Purpose

#error is one of the built-in output streams, and the standard error stream for OmniMark.

#error always refers to the standard error, also known as stderr.

If no -log argument is given on the command line, OmniMark writes all errors and informative messages to #error. If an implementation of OmniMark on a particular platform does not distinguish between standard output and standard error, they are defined as the same destination.

Since #error is considered domain free by default, neither the domain-free modifier nor the z modifier has any effect on it.

The following code illustrates the use of #error for reporting errors:

  global integer list-count
  
  process
     local integer list-items variable 
  
     ; ...
  
     do when number of list-items != list-count
        local integer temp
  
        put #error "Found a condition that shouldn't have happened:"
        set temp to number of list-items
  
        put #error " list-count = %d(list-count), but list-items has %d(temp) item(s).%n"
        halt with 2 ; signals an error condition while stopping
     done
          

Line breaking rules and translate rules are never applied to #error.

On most systems, standard error (and as a result #error) is unbuffered: that is, text written to it is immediately output. This can be changed by declaring #error to be buffered:

  declare #error has buffered
          
#error can also be declared unbuffered, although this is the default.

In any program that uses referents, #error is treated as if it were opened with referents-displayed.