18
18
19
19
package org .openqa .selenium .remote ;
20
20
21
+ import static org .openqa .selenium .remote .ErrorCodes .SUCCESS ;
22
+
21
23
import com .google .common .base .Function ;
22
24
import com .google .common .base .Predicates ;
23
25
import com .google .common .base .Throwables ;
33
35
import java .util .List ;
34
36
import java .util .Map ;
35
37
36
- import static org .openqa .selenium .remote .ErrorCodes .SUCCESS ;
37
-
38
38
/**
39
39
* Maps exceptions to status codes for sending over the wire.
40
40
*
@@ -54,7 +54,7 @@ public class ErrorHandler {
54
54
private static final String UNKNOWN_METHOD = "<anonymous method>" ;
55
55
private static final String UNKNOWN_FILE = null ;
56
56
57
- private final ErrorCodes errorCodes = new ErrorCodes () ;
57
+ private ErrorCodes errorCodes ;
58
58
59
59
private boolean includeServerErrors ;
60
60
@@ -68,6 +68,17 @@ public ErrorHandler() {
68
68
*/
69
69
public ErrorHandler (boolean includeServerErrors ) {
70
70
this .includeServerErrors = includeServerErrors ;
71
+ this .errorCodes = new ErrorCodes ();
72
+ }
73
+
74
+ /**
75
+ * @param includeServerErrors Whether to include server-side details in thrown exceptions if the
76
+ * information is available.
77
+ * @param codes The ErrorCodes object to use for linking error codes to exceptions.
78
+ */
79
+ public ErrorHandler (ErrorCodes codes , boolean includeServerErrors ) {
80
+ this .includeServerErrors = includeServerErrors ;
81
+ this .errorCodes = codes ;
71
82
}
72
83
73
84
public boolean isIncludeServerErrors () {
0 commit comments