When the SDK request fails, the
error field returned is not empty, but instead includes an error code, error description, and other necessary debugging information to help developers quickly fix any issues. Error codes (outlined in the returned error field) include those returned by the client and those returned by the server.Client Errors
For error codes generated by the device itself due to network issues, they are negative four-digit numbers, such as -1001. These error codes are defined by Apple and can be found in the NSURLError.h header file within the Foundation framework.
Custom errors returned by the local client in the SDK network layer includes network exception, invalid certificate and invalid parameter, which is as shown below:
Error Codes | Error Message | Error Description |
10000 | InvalidArgument | Invalid parameter |
10001 | InvalidCredentials | Invalid certificate |
10004 | UnsupportOperation | Unsupported operation |
20001 | InvalidArgument | Invalid data returned by the server |
20004 | PoorNetwork | A verification for data integrity failed. |
30000 | UserCancelled | The user has canceled the request. |
30002 | AlreadyFinished | The job has already finished. |
Server Errors
Error codes returned by COS are based on HTTP status codes, such as 404 and 503. For more information on these error codes, see Error Codes. You can also use the self-diagnosis tool to debug the code and quickly locate request errors.
Using self-diagnose tools
COS provides a self-help diagnosis tool to help you quickly locate request errors and debug the code.
Directions
1. Copy the RequestId (Request ID) returned by the exception handling process.
2. Click Diagnosis Tool.
3. Enter the RequestId to be diagnosed in the RequestId input box at the top, and click Start Diagnosis. Please wait patiently for a few minutes to view the corresponding intelligent diagnosis results.