ServiceException.java
2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
* CloudframeworkException.java
*
* 深圳广联赛讯有限公司
*
* Copyright (C) 2012 WONDERSHARE.COM
*
* All Right reserved
* http://www.glsx.com.cn
*/
package com.bs.cardata.exception;
/**
* Base class for all custom exception thrown in CloudFramework
*
* @author Cruise.Xu
* @date: 2012-10-15
*
*/
public class ServiceException extends Exception {
/**
* uid used for serialization
*/
private static final long serialVersionUID = 7696865849245536841L;
/**
* Exception code
*/
private String code;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
/**
* Default constructor
*/
public ServiceException() {
super();
}
/**
* Create a new CloudframeworkException from a message which explain the nature of
* the Exception
*/
public ServiceException(String message) {
super(message);
}
public ServiceException(String code, String message) {
super(message);
this.code = code;
}
/**
* Create a new CloudframeworkException from a message and a base throwable
* exception
*/
public ServiceException(String message, Throwable throwable) {
super(message, throwable);
}
public ServiceException(String code, String message, Throwable throwable) {
super(message, throwable);
this.code = code;
}
public ServiceException(ServiceErrorType serviceErrorType) {
super(ServiceErrorType.msgValue(serviceErrorType));
this.code = ServiceErrorType.codeValue(serviceErrorType);
}
public ServiceException(ServiceErrorType serviceErrorType, Throwable throwable) {
super(ServiceErrorType.msgValue(serviceErrorType), throwable);
this.code = ServiceErrorType.codeValue(serviceErrorType);
}
public ServiceException(ServiceErrorType serviceErrorType, String message, Throwable throwable) {
super(ServiceErrorType.msgValue(serviceErrorType) + ":" + message, throwable);
this.code = ServiceErrorType.codeValue(serviceErrorType);
}
}