[PATCH 3/3] hook: return error codes to previos functions