return errorcode when failing