event error hook rewrite