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

com.googlecode.jsonrpc4j.DefaultErrorResolver Maven / Gradle / Ivy

Go to download

This project aims to provide the facility to easily implement JSON-RPC for the java programming language.

There is a newer version: 1.6
Show newest version
package com.googlecode.jsonrpc4j;

import com.fasterxml.jackson.databind.JsonNode;

import java.lang.reflect.Method;
import java.util.List;

import static com.googlecode.jsonrpc4j.ErrorResolver.JsonError.ERROR_NOT_HANDLED;

/**
 * An {@link ErrorResolver} that puts type information into the
 * data portion of the error.  This {@link ErrorResolver} always
 * returns a {@link com.googlecode.jsonrpc4j.ErrorResolver.JsonError JsonError}.
 */
@SuppressWarnings("WeakerAccess")
public enum DefaultErrorResolver implements ErrorResolver {
	INSTANCE;
	
	/**
	 * {@inheritDoc}
	 */
	public JsonError resolveError(Throwable t, Method method, List arguments) {
		return new JsonError(ERROR_NOT_HANDLED.code, t.getMessage(), new ErrorData(t.getClass().getName(), t.getMessage()));
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy