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

org.springframework.social.evernote.api.EvernoteException Maven / Gradle / Ivy

There is a newer version: 1.0.3
Show newest version
package org.springframework.social.evernote.api;

import com.evernote.edam.error.EDAMErrorCode;
import com.evernote.edam.error.EDAMNotFoundException;
import com.evernote.edam.error.EDAMSystemException;
import com.evernote.edam.error.EDAMUserException;
import com.evernote.thrift.TException;

/**
 * Runtime exception that encapsulates typed exceptions from evernote sdk.
 *
 * @author Tadaya Tsuyukubo
 */
public class EvernoteException extends RuntimeException {

	public EvernoteException(String message, Throwable cause) {
		super(message, cause);
	}

	public boolean isEDAMUserException() {
		return getCause() instanceof EDAMUserException;
	}

	public boolean isEDAMSystemException() {
		return getCause() instanceof EDAMSystemException;
	}

	public boolean isEDAMNotFoundException() {
		return getCause() instanceof EDAMNotFoundException;
	}

	public boolean isTException() {
		return getCause() instanceof TException;
	}

	public EDAMErrorCode getEDAMErrorCode() {
		if (isEDAMUserException()) {
			return ((EDAMUserException) getCause()).getErrorCode();
		} else if (isEDAMSystemException()) {
			return ((EDAMSystemException) getCause()).getErrorCode();
		}
		return null;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy