Return error code if an exception happen.