Add the right error handlers when security hook failed.