return a more suitable error code