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

com.siftscience.exception.SiftException Maven / Gradle / Ivy

There is a newer version: 3.16.0
Show newest version
package com.siftscience.exception;

import com.siftscience.SiftResponse;

public class SiftException extends RuntimeException {
    private SiftResponse response;

    public SiftException(String msg) {
        super(msg);
    }

    public SiftException(SiftResponse response) {
        super(responseErrorMessage(response));
        this.response = response;
    }

    public SiftResponse getSiftResponse() {
        return this.response;
    }

    private static String responseErrorMessage(SiftResponse response) {
        if (response == null || response.getApiErrorMessage() == null) {
            return "Unexpected API error.";
        }
        return response.getApiErrorMessage();
    }

    public String getApiErrorMessage() {
        return responseErrorMessage(response);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy