file: 01-C-event.t package: muf status: alpha
This function is the standard way for the MUF application programmer to signal detection of a continuable error.
The argument should be a valid event block,
containing at minimum a event, and normally
also a :formatString
describing the
problem:
[ :event .err.simpleError :formatString "The snarkle got frobulated." |
The ]cerror
function first establishes
a continue
restart, then ]signal
s
the event, then if ]signal
returns
(indicating no handler resolved the problem)
either invokes the debugger or else prints
an error message and aborts, depending whether
@$s.breakEnable
is nil
.
The ]cerror
function is currently implemented as:
: ]cerror { [] -> ! } ( Establish a 'cont tag that returns to caller: ) withTag cont do{ ( Establish a 'continue restart jumping to 'cont: ) [ :function :: { -> ! } 'cont goto ; :name 'continue :reportFunction "Continue from ]cerror call." | ]withRestartDo{ ( Issue the requested signal: ) |dup[ ]signal ( Handlers didn't resolve event: ) @$s.breakEnable if ]invokeDebugger else @$s.errorOutput ]reportEvent nil abort fi } cont ]pop } ;
A convenience function cerror
is also provided
for cases when specifying a string is sufficient: It
is currently implemented as
: cerror { $ -> } -> formatString [ :event .err.simpleError :formatString formatString | ]cerror ;
Go to the first, previous, next, last section, table of contents.