It is possible to protect a part of a program against abrupt termination in the event of an exception. There are several ways to do this:
catch/3as described in ref-ere-hex-pgo.
user:unknown_predicate_handler/3; see ref-ere-hex-hup.
syntax_errorsProlog flag or with the same option to
read_term/[2,3]; see ref-ere-err-syn.
fileerrorsProlog flag or with the same option to
absolute_file_name/3; see ref-ere-err-exi and ref-ere-err-per.