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

com.lookfirst.wepay.WePayException Maven / Gradle / Ivy

The newest version!
package com.lookfirst.wepay;

import lombok.Getter;

/**
 * The possible errors that are generated by wepay itself
 * 
 * https://stage.wepay.com/developer/reference/errors 
 */
public class WePayException extends RuntimeException {
	private static final long serialVersionUID = 1L;

	/** The raw error type string */
	@Getter
	String error;
	
	/** The error string converted to a known enum, or null if unknown */
	@Getter
	WePayError errorType;
	
	/** The error text by itself */
	@Getter
	String errorText;

	@Getter
	Integer errorCode;

	/** */
	public WePayException(String error, String errorText, Integer errorCode) {
		super(error + ": " + errorText);
		
		this.error = error;
		this.errorText = errorText;
		this.errorCode = errorCode;
		
		// If wepay adds a new error, we won't have it registered
		try {
			errorType = WePayError.valueOf(error);
		} catch (Exception ex) {}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy