Class NgrokApiError

All Implemented Interfaces:
Serializable

public class NgrokApiError extends RuntimeException
Representation of an API error from ngrok.
See Also:
  • Constructor Details

    • NgrokApiError

      public NgrokApiError(String message, int httpStatusCode, Optional<String> errorCode, Map<String,String> details)
      Creates a new API error.
      Parameters:
      message - informative message
      httpStatusCode - HTTP response status
      errorCode - ngrok API error code
      details - arbitrary error details
    • NgrokApiError

      public NgrokApiError(int httpStatusCode, Optional<String> responseBody, Throwable cause)
      Creates a new API error.
      Parameters:
      httpStatusCode - HTTP response status
      responseBody - possible response body
      cause - exception cause
    • NgrokApiError

      public NgrokApiError(int httpStatusCode)
      Creates a new API error.
      Parameters:
      httpStatusCode - HTTP response status
  • Method Details

    • getHttpStatusCode

      public int getHttpStatusCode()
      Fetches the HTTP status code.
      Returns:
      HTTP response status
    • getErrorCode

      public Optional<String> getErrorCode()
      Fetches the ngrok API error code, if any.
      Returns:
      ngrok API error code
    • getDetails

      public Map<String,String> getDetails()
      Fetches any further details about the error.
      Returns:
      key-value map containing error details
    • isErrorCode

      public boolean isErrorCode(String... codes)
      Checks if this error object contains one of the provided codes.
      Parameters:
      codes - error codes to check
      Returns:
      whether or not one of the codes matches what is in this error object