View Javadoc
1   package org.oxerr.okcoin.rest;
2   
3   import org.knowm.xchange.exceptions.ExchangeException;
4   
5   import com.fasterxml.jackson.annotation.JsonProperty;
6   
7   /**
8    * Exception to represent the exception from server side.
9    */
10  public class OKCoinException extends ExchangeException {
11  
12  	private static final long serialVersionUID = 20140614L;
13  
14  	private final Integer errorCode;
15  
16  	public OKCoinException() {
17  		this((Integer) null, (String) null);
18  	}
19  
20  	public OKCoinException(@JsonProperty("error_code") Integer errorCode) {
21  		this(errorCode,
22  			errorCode != null ? Messages.getString(String.valueOf(errorCode)) : null);
23  	}
24  
25  	/**
26  	 * Constructor.
27  	 *
28  	 * @param errorCode the error code.
29  	 * @param message the exception message.
30  	 */
31  	public OKCoinException(Integer errorCode, String message) {
32  		super(message);
33  		this.errorCode = errorCode;
34  	}
35  
36  	public OKCoinException(String message) {
37  		this((Integer) null, message);
38  	}
39  
40  	public OKCoinException(String message, Throwable cause) {
41  		super(message, cause);
42  		this.errorCode = null;
43  	}
44  
45  	/**
46  	 * @return the error code.
47  	 */
48  	public Integer getErrorCode() {
49  		return errorCode;
50  	}
51  
52  }