Example usage for org.apache.commons.lang3.exception ContextedException ContextedException

List of usage examples for org.apache.commons.lang3.exception ContextedException ContextedException

Introduction

In this page you can find the example usage for org.apache.commons.lang3.exception ContextedException ContextedException.

Prototype

public ContextedException(final String message, final Throwable cause) 

Source Link

Document

Instantiates ContextedException with cause and message.

Usage

From source file:com.rodaxsoft.mailgun.AbstractMailgunRoutine.java

/**
 * Returns a connected REST connection object
 * @param apiKey The API key//  ww  w.j  a  v  a  2s .co m
 * @return A connected REST connection object
 * @throws ContextedException if connection error occurs
 */
protected RESTConnection restConnection(String apiKey) throws ContextedException {

    try {

        return RESTConnectionFactory.getRESTConnection().connect(account.getBaseUri(), apiKey);
    }

    catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
        throw new ContextedException("Instantiation Error", e).addContextValue("baseUri", account.getBaseUri())
                .addContextValue("apiKey", apiKey);

    }
}