Next: , Previous: , Up: mpg-bpr   [Contents][Index]


11.3.121 message_hook/3   hook

Synopsis

:- multifile user:message_hook/3.

user:message_hook(+Severity, +MessageTerm, +Lines)

Overrides the call to print_message_lines/3 in print_message/2. A way for the user to intercept the Message of type Severity, whose translations is Lines, before it is actually printed.

Arguments

Severity

one of [informational,warning,error,help,silent]

MessageTerm

term

Lines

list of list of pair

Is of the form [Line1, Line2, …], where each Linei is of the form [Control_1-Args_1,Control_2-Args_2, …].

Description

After a message is parsed, but before the message is written, print_message/2 calls

user:message_hook(+Severity,+MsgTerm,+Lines)

If the call to user:message_hook/3 succeeds, then print_message/2 succeeds without further processing. Otherwise the built-in message portrayal is used. It is often useful to have a message hook that performs some action and then fails, allowing other message hooks to run, and eventually allowing the message to be printed as usual.

Exceptions

An exception raised by this predicate causes an error message to be printed and then the original message is printed using the default message text and formatting.

See Also

ref-msg.


Send feedback on this subject.