Package com.pdfgate

Class PdfGateException

All Implemented Interfaces:
Serializable

public final class PdfGateException extends IOException
Exception raised for PDFGate API errors and transport failures.
See Also:
  • 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 -1 when unavailable.
      responseBody - raw response body.
      headers - response headers.
  • Method Details

    • fromResponse

      public static PdfGateException fromResponse(okhttp3.Response response) throws IOException
      Creates a PdfGateException from an HTTP response.
      Parameters:
      response - the HTTP response, possibly null.
      Returns:
      a populated PdfGateException describing the failure.
      Throws:
      IOException - when reading the response body fails.
    • fromException

      public static PdfGateException fromException(IOException e)
      Creates a PdfGateException from an IO failure.
      Parameters:
      e - the underlying failure.
      Returns:
      a populated PdfGateException describing the failure.
    • fromParseFailure

      public static PdfGateException fromParseFailure(okhttp3.Response response, String responseBody, Throwable cause)
      Creates a PdfGateException from a successful response that could not be parsed.
      Parameters:
      response - the successful HTTP response, possibly null.
      responseBody - raw response body that failed to parse.
      cause - the underlying parsing failure.
      Returns:
      a populated PdfGateException describing the parse failure.
    • getStatusCode

      public int getStatusCode()
      Returns the HTTP status code or -1 when unavailable.
      Returns:
      the HTTP status code or -1 when unavailable.
    • getResponseBody

      public String 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.