Package com.pdfgate
Class PdfGateException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
com.pdfgate.PdfGateException
- All Implemented Interfaces:
Serializable
Exception raised for PDFGate API errors and transport failures.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPdfGateException(String message, int statusCode, String responseBody, okhttp3.Headers headers) Creates a new exception with the provided response details. -
Method Summary
Modifier and TypeMethodDescriptionstatic PdfGateExceptionCreates aPdfGateExceptionfrom an IO failure.static PdfGateExceptionfromParseFailure(okhttp3.Response response, String responseBody, Throwable cause) Creates aPdfGateExceptionfrom a successful response that could not be parsed.static PdfGateExceptionfromResponse(okhttp3.Response response) Creates aPdfGateExceptionfrom an HTTP response.okhttp3.HeadersReturns the HTTP response headers.Returns the raw response body.intReturns the HTTP status code or-1when unavailable.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
PdfGateException
public PdfGateException(String message, int statusCode, String responseBody, okhttp3.Headers headers) Creates a new exception with the provided response details.- Parameters:
message- message describing the error.statusCode- HTTP status code or-1when unavailable.responseBody- raw response body.headers- response headers.
-
-
Method Details
-
fromResponse
Creates aPdfGateExceptionfrom an HTTP response.- Parameters:
response- the HTTP response, possiblynull.- Returns:
- a populated
PdfGateExceptiondescribing the failure. - Throws:
IOException- when reading the response body fails.
-
fromException
Creates aPdfGateExceptionfrom an IO failure.- Parameters:
e- the underlying failure.- Returns:
- a populated
PdfGateExceptiondescribing the failure.
-
fromParseFailure
public static PdfGateException fromParseFailure(okhttp3.Response response, String responseBody, Throwable cause) Creates aPdfGateExceptionfrom a successful response that could not be parsed.- Parameters:
response- the successful HTTP response, possiblynull.responseBody- raw response body that failed to parse.cause- the underlying parsing failure.- Returns:
- a populated
PdfGateExceptiondescribing the parse failure.
-
getStatusCode
public int getStatusCode()Returns the HTTP status code or-1when unavailable.- Returns:
- the HTTP status code or
-1when unavailable.
-
getResponseBody
Returns the raw response body.- Returns:
- the raw response body.
-
getHeaders
public okhttp3.Headers getHeaders()Returns the HTTP response headers.- Returns:
- the HTTP response headers.
-