The normal way of handling this would be to check the second argument to the error handler (the error "severity"). If the severity is > 10 it is an error, and you should return a positive value from the handler so that DBI's normal error handling can catch the error. If the severity is <= 10 you do what you want with the message, and return 0 from the handler so that there is no risk that DBI will catch the error/message.