public class ServiceException extends MaxStorageException
It extends OdpsException and adds context information such as HTTP status code, service-defined error code, and request ID, allowing callers to perform more precise error handling and problem diagnosis.
| Constructor and Description |
|---|
ServiceException(int httpStatus,
String errorCode,
String errorMessage,
String requestId)
Constructs a new ServiceException.
|
ServiceException(int httpStatus,
String errorCode,
String errorMessage,
String requestId,
Throwable cause) |
| Modifier and Type | Method and Description |
|---|---|
String |
getErrorCode()
Gets the service-defined business error code.
|
int |
getHttpStatus()
Gets the HTTP status code.
|
String |
getRequestId()
Gets the unique ID for this request.
|
String |
toString() |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTracepublic ServiceException(int httpStatus,
String errorCode,
String errorMessage,
String requestId)
httpStatus - HTTP response status code (e.g., 404, 500).errorCode - Business error code defined by the service in the response body (e.g., "TableNotFound").errorMessage - Error description information defined by the service in the response body.requestId - Unique ID for tracking this request (usually from the x-odps-request-id header).public int getHttpStatus()
public String getErrorCode()
public String getRequestId()
Copyright © 2026 Alibaba Cloud Computing. All rights reserved.