Added error message hook.