forked from kohsuke/com4j
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathErrorInfo.java
More file actions
111 lines (96 loc) · 2.34 KB
/
Copy pathErrorInfo.java
File metadata and controls
111 lines (96 loc) · 2.34 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package com4j;
import java.io.File;
/**
* Represents error information.
*
* <p>
* This is a Java bean version of <tt>IErrorInfo</tt> COM interface.
*
* @author Kohsuke Kawaguchi
*/
public class ErrorInfo {
private GUID guid;
private String source;
private String description;
private File helpFile;
private Integer helpContext;
/*package*/ ErrorInfo(IErrorInfo ei) {
try {
this.guid = ei.guid();
} catch (ComException e) {
// ignore
}
try {
this.source = ei.source();
} catch (ComException e) {
// ignore
}
try {
this.description = ei.description();
} catch (ComException e) {
// ignore
}
try {
String pathname = ei.helpFile();
if(pathname!=null)
this.helpFile = new File(pathname);
else
this.helpFile = null;
} catch (ComException e) {
// ignore
}
try {
this.helpContext = ei.helpContext();
} catch (ComException e) {
// ignore
}
}
/**
* Returns GUID for the interface that defined the error.
*
* @return
* null if no such information is available.
*/
public GUID getGuid() {
return guid;
}
/**
* Returns the ProgID for the class or application that returned the error.
*
* @return
* null if no such information is available.
*/
public String getSource() {
return source;
}
/**
* Returns a textual description of the error.
*
* @return
* null if no such information is available.
*/
public String getDescription() {
return description;
}
/**
* Returns the path of the Help file that describes the error.
*
* @return
* null if no such information is available.
*/
public File getHelpFile() {
return helpFile;
}
/**
* Returns the Help context identifier (ID) for the error.
*
* @return
* null if no such information is available.
*/
public Integer getHelpContext() {
return helpContext;
}
public String toString() {
return description!=null ? description : "(no description)";
}
}