error. ( error -- )
Factor handbook » The language » Exception handling » The debugger

Prev:try ( quot -- )
Next::error ( -- )


Vocabulary
debugger

Inputs
erroran error


Outputs
None

Generic word contract
Print an error to output-stream. You can define methods on this generic word to print human-readable messages for custom errors.

Notes
Code should call print-error instead, which handles the case where the printing of the error itself throws an error.

Definition


Methods

M: ambiguous-option error.
"The option '" write dup arg>> write
"' matches more than one (" write options>>
[ ", " write ] [ option-name write ] interleave ")" print ;









M: attr-w/< error.
M\ attr-w/< error. (call-next-method)
"Attribute value contains literal <" print ;



M: bad-cdata error.
M\ bad-cdata error. (call-next-method)
"CDATA occurs before or after main tag" print ;












M: bad-encoding error.
M\ bad-encoding error. (call-next-method)
"Encoding in XML document does not exist" print ;



M: bad-escape error. "Bad escape code: \\" write char>> write1 ;















M: bad-version error.
"XML version must be \"1.0\" or \"1.1\". Version here was "
write num>> . ;



M: cannot-convert-value error.
"Unable to convert value '" write dup str>> write
"' with converter '" write converter>> pprint "'" print ;






M: capitalized-prolog error.
dup M\ capitalized-prolog error. (call-next-method)
"XML prolog name was partially or totally capitalized, using"
print "<?" write name>> write "...?>" write
" instead of <?xml...?>" print ;



M: compile-shader-error error.
"The GLSL shader " write
[ shader>> name>> pprint-short " failed to compile." print ]
[ log>> print ] bi ;






M: couchdb-error error.
"CouchDB Error: " write data>> "error" over at
[ print ] when* "reason" of [ print ] when* ;



M: deprecated-usages error.
"The definition of " write dup asset>> pprint
" uses these deprecated words:" print usages>>
[ " " write pprint nl ] each ;



M: descriptive-error error.
"The word " write dup word>> pprint
" encountered an error." print "Arguments:" print
dup args>> stack. "Error:" print underlying>> error. ;






M: download-failed error.
"HTTP request failed:" print nl response>> ... ;






M: expected-arguments error.
"Expected more arguments for option '" write
option>> option-name write "'" print ;






M: extra-attrs error.
dup M\ extra-attrs error. (call-next-method)
"Extra attributes included in xml version declaration:"
print attrs>> . ;



M: game-loop-error-state error.
"An error occurred inside a game loop." print
"The game loop has been stopped to prevent runaway errors."
print "The error was:" print nl error>> error. ;






M: inaccurate-feedback-attribute-error error.
drop
"The types of the transform feedback attributes don't match th..."
print ;



M: invalid-link-feedback-format-error error.
drop
"Vertex formats used for transform feedback can't contain padd..."
print ;



M: invalid-value error.
"Invalid value '" write dup value>> write
"' for option '" write option>> option-name write "'" print
;






M: libc-error error.
"Unix system call failed:" print nl dup message>> write
" (" write errno>> pprint ")" print ;



M: link-program-error error.
"The GLSL program " write
[ shader>> name>> pprint-short " failed to link." print ]
[ log>> print ] bi ;















M: multitags error.
drop "XML document contains multiple main tags" print ;



M: no-boilerplate error.
drop
"get-title and set-title can only be used from within" print
"a with-boilerplate form" print ;



M: no-compilation-unit error.
"Attempting to define " write definition>> pprint
" outside of a compilation unit" print ;






M: no-method error.
"Generic word " write dup generic>> pprint
" does not define a method for the " write
dup object>> class-of pprint " class." print
"Dispatching on object: " write object>> short. ;



M: no-method error.
"Type check error" print nl "Generic word " write
dup generic>> pprint
" does not have a method applicable to inputs:" print
dup arguments>> short. nl "Inputs have signature:" print
dup arguments>> [ class-of ] map niceify-method .
nl "Available methods: " print
generic>> methods canonicalize-specializers drop
sort-methods keys [ niceify-method ] map stack. ;


















M: not-yes/no error.
dup M\ not-yes/no error. (call-next-method)
"standalone must be either yes or no, not \"" write
text>> write "\"." print ;



M: notags error. drop "XML document lacks a main tag" print ;









M: parse-error error.
[
"Peg parsing error at character position " write
position>> number>string write
] [ ".\nExpected " write messages>> " or " join write ]
[ "\nGot '" write got>> write "'" print ] tri ;



M: pre/post-content error.
"The text string:" print dup string>> . "was used " write
pre?>> "before" "after" ? write " the main tag." print ;



M: process-already-started error.
"Process has already been started" print
nl "Launch descriptor:" print nl process>> . ;



M: process-failed error.
[
"Process exited with error code " write
process>> status>> . nl "Launch descriptor:" print nl
] [ process>> . ] bi ;



M: process-was-killed error.
"Process was killed as a result of a call to" print
"kill-process, or a timeout" print
nl "Launch descriptor:" print nl process>> . ;



M: quoteless-attr error.
M\ quoteless-attr error. (call-next-method)
"Attribute lacks quotes around value" print ;



M: redefine-error error. "Re-definition of " write def>> . ;






M: server-error error.
"Error in XML supplied to server" print
"Description: " write dup message>> print "Tag: " write
tag>> xml>string print ;















M: template-error error.
"Error while processing template " write
[ template>> short. ":" print nl ] [ error>> error. ] bi ;









M: too-many-feedback-formats-error error.
drop
"Only one transform feedback format can be specified for a pro..."
print ;









M: unbalanced-branches-error error.
dup summary print nl "For more information, evaluate:" print
" \"inference-branches\" help" print nl
[ quots>> ] [ declareds>> ] [ actuals>> ] tri 3array flip
{ "Input" "Expected" "Got" } prefix simple-table. ;



M: unclosed-quote error.
M\ unclosed-quote error. (call-next-method)
"XML document ends with quote still open" print ;






M: uncompressable-image error.
drop "This image format does not support compression" print
;









M: unix-system-call-error error.
"Unix system call '" write dup word>> pprint
"' failed:" print nl dup message>> write " (" write
dup errno>> pprint ")" print
nl "It was called with the following arguments:" print
nl args>> stack. ;



M: unknown-option error.
"Unknown option '" write str>> write "'" print ;









M: unsupported-image-header error.
drop "Could not detect a valid image header" print ;















M: world-error error.
"An error occurred while drawing the world " write
dup world>> pprint-short "." print
"This world has been deactivated to prevent cascading errors."
print error>> error. ;



M: xml-error error.
"XML parsing error" print "Line: " write dup line>> .
"Column: " write column>> . ;