-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathUErrorException.java
executable file
·55 lines (51 loc) · 1.04 KB
/
UErrorException.java
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
package jtux;
public class UErrorException extends java.lang.Exception {
private int code;
private int type;
public static final int EC_ERRNO = 0;
public static final int EC_EAI = 1;
public static final int EC_GETDATE = 2;
public UErrorException() {
}
public UErrorException(int code) {
this.code = code;
this.type = EC_ERRNO;
}
public UErrorException(int code, int type) {
this.code = code;
this.type = type;
}
public String toString() {
String s, desc;
try {
switch (type) {
case EC_ERRNO:
s = UUtil.GetSymbolStr("errno", code);
desc = UUtil.strerror(code);
break;
case EC_EAI:
s = UUtil.GetSymbolStr("eai", code);
desc = UNetwork.gai_strerror(code);
break;
case EC_GETDATE:
s = UUtil.GetSymbolStr("getdate_err", code);
desc = "getdate error";
break;
default:
s = "[Unk. Type]";
desc = "?";
}
}
catch (Exception e) {
s = "???";
desc = "?";
}
return desc + " (" + s + ")";
}
public int getCode() {
return code;
}
public int getType() {
return type;
}
}