An error handler such as PredSpec can have 3 optional arguments: the 1st argument is the number of the error; the 2nd argument is the culprit (a structure corresponding to the call which caused it); the 3rd is the context module or a free variable (if the module is unknown). The error handler is free to use less than 3 arguments.
The errors which exist are implementation defined.
Success: [eclipse]: string_list(S,L). instantiation fault in string_list(_g50, _g52) [eclipse]: get_error_handler(4,M,N). M = error_handler/2 N = sepia_kernel yes. [eclipse]: set_error_handler(4,true/0), string_list(S,L). S = _g56 L = _g58 yes. [eclipse]: [user]. a :- write(warning_output, "typo"), fail. user compiled 100 bytes in 0.03 seconds [eclipse]: set_error_handler(5,a/0). yes. [eclipse]: atom_length("atom",L). typo no. Error: set_error_handler(N,true/0). (Error 4). set_error_handler(5,P). (Error 4). set_error_handler(5.0,true/0). (Error 5). set_error_handler(1000,X). (Error 6). set_error_handler(-1,X). (Error 6). set_error_handler(6,a/4). (Error 6). % arity > 3. set_error_handler(6,t/2). (Error 60). % no t/2.