Next: ref-ere-err-per, Previous: ref-ere-err-rep, Up: ref-ere-err [Contents][Index]
An existence error occurs when a predicate attempts to access something that does not exist. For example, trying to compile a file that does not exist, erasing a database reference that has already been erased.
The SICStus_Error term associated with an existence error is
existence_error(Goal, ArgNo, ObjectType, Culprit, Message)
index of argument of Goal where Culprit appears
expected type of non-existent object
name for the non-existent object
the constant 0
or ''
, or
some additional information provided by the operating system or other
support system indicating why Culprit is thought not to exist.
For example, ‘see('../brother/niece')’ might throw the exception
error(existence_error(source_sink,'../brother/niece'), existence_error(see('../brother/niece'),1,file,'../brother/niece',0))
An existence error does not necessarily cause an exception to be thrown.
For I/O predicates,
the behavior can be controlled with the fileerrors
Prolog flag
(see ref-lps-flg) or with the fileerrors/1
alias
file_errors/1
option to absolute_file_name/3
. The
following values are possible:
on (fileerrors flag value)
error (absolute_file_name/3 fileerrors value)
Throw an exception if a given file cannot be opened. The default.
off (fileerrors flag value)
fail (absolute_file_name/3 fileerrors value)
Merely fail if a given file cannot be opened.