All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.oohira.intercom.IntercomException Maven / Gradle / Ivy

There is a newer version: 0.0.4
Show newest version
package com.github.oohira.intercom;

import com.github.oohira.intercom.model.ErrorResponse;

/**
 * This exception is raised if there is a issue during calling Intercom APIs.
 *
 * @author oohira
 */
public class IntercomException extends RuntimeException {
    private ErrorResponse error;

    public IntercomException(final String message) {
        super(message);
    }

    public IntercomException(final ErrorResponse error) {
        super(error.getType() + ": " + error.getMessage());
        this.error = error;
    }

    public IntercomException(final Throwable cause) {
        super(cause);
    }

    /**
     * Get an error response object from Intercom.
     *
     * @return an error response object. (may be null)
     * @see 
     *     Intercom API Documentation: Response Codes & Errors
     */
    public ErrorResponse getErrorResponse() {
        return this.error;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy