print_message/2
[hookable]print_message(
+Severity,
+MessageTerm)
Print a Message of a given Severity. The behavior can be
customized using the hooks user:portray_message/2
,
user:generate_message_hook/3
and user:message_hook/3
.
Unless the default system portrayal is overidden with
user:message_hook/3
, Severity must be one of:
informational
warning
error
help
query
silent
First print_message/2
calls user:portray_message/2
with
the same arguments. If this does not succeed, the message is
processed in the following phases:
user:generate_message_hook/3
is tried, then if it
does not succeed, 'SU_messages':generate_message/3
is called.
The latter predicate is defined in terms of definite clause grammars
in library('SU_messages')
. If that also does not succeed, then
the built-in default conversion is used, which gives the following
result:
['~q'-[Message],nl]
user:message_hook/3
is tried, then, if it does not
succeed, the built-in predicate print_message_lines/3
is
called for the user_error
stream.
An unhandled exception message E calls
print_message(error,
E)
before returning to the top
level. The convention is that an error message is the result of an
unhandled exception. Thus, an error message should only be printed if
raise_exception/1
does not find a handler and unwinds to the
top-level.
All messages from the system are printed using this predicate. Means of intercepting these messages before they are printed are provided.
print_message/2
always prints to user_error
. Messages can be
redirected to other streams using user:message_hook/3
and
print_message_lines/3
Silent messages do not get translated or printed, but they can be
intercepted with user:portray_message/2
and user:message_hook/3
.
instantiation_error
type_error
domain_error