parsererrorhook
parsererrorhook
Function prototype:
hook(err, msg, file, line)
Synopsis
Use with:
add_hook(hookname, func[, prepend])
remove_hook(hookname, func)
where hookname is parsererrorhook.
This hook is called before a parser error or warning is output. The hook function is passed err, a boolean specifying 1 if msg is an error and 0 if msg is a warning, and msg is a string containing the parser message. file is the name of the file to which the message applies, and line is the line number in the file producing the error.
If the hook function returns -1, the message is suppressed. Otherwise, the message is output as usual.
In this example, the hook function suppresses warnings but not errors.
function ParserErrorHook(err, msg)
{
if (! err)
{
return -1; # suppress message
}
return 0;
}
add_hook("parsererrorhook", "ParserErrorHook");