@@ -27,11 +27,6 @@ namespace OpenQA.Selenium
2727 /// </summary>
2828 public class ErrorResponse
2929 {
30- private StackTraceElement [ ] ? stackTrace ;
31- private string message = string . Empty ;
32- private string className = string . Empty ;
33- private string screenshot = string . Empty ;
34-
3530 /// <summary>
3631 /// Initializes a new instance of the <see cref="ErrorResponse"/> class.
3732 /// </summary>
@@ -51,23 +46,21 @@ public ErrorResponse(Dictionary<string, object?>? responseValue)
5146 if ( responseValue . TryGetValue ( "message" , out object ? messageObj )
5247 && messageObj ? . ToString ( ) is string message )
5348 {
54- this . message = message ;
49+ this . Message = message ;
5550 }
5651 else
5752 {
58- this . message = "The error did not contain a message." ;
53+ this . Message = "The error did not contain a message." ;
5954 }
6055
61- if ( responseValue . TryGetValue ( "screen" , out object ? screenObj )
62- && screenObj ? . ToString ( ) is string screen )
56+ if ( responseValue . TryGetValue ( "screen" , out object ? screenObj ) )
6357 {
64- this . screenshot = screen ;
58+ this . Screenshot = screenObj ? . ToString ( ) ;
6559 }
6660
67- if ( responseValue . TryGetValue ( "class" , out object ? classObj )
68- && classObj ? . ToString ( ) is string @class )
61+ if ( responseValue . TryGetValue ( "class" , out object ? classObj ) )
6962 {
70- this . className = @class ;
63+ this . ClassName = classObj ? . ToString ( ) ;
7164 }
7265
7366 if ( responseValue . TryGetValue ( "stackTrace" , out object ? stackTraceObj )
@@ -84,7 +77,7 @@ public ErrorResponse(Dictionary<string, object?>? responseValue)
8477 }
8578 }
8679
87- this . stackTrace = stackTraceList . ToArray ( ) ;
80+ this . StackTrace = stackTraceList . ToArray ( ) ;
8881 }
8982 }
9083 }
@@ -93,38 +86,22 @@ public ErrorResponse(Dictionary<string, object?>? responseValue)
9386 /// <summary>
9487 /// Gets or sets the message from the response
9588 /// </summary>
96- public string Message
97- {
98- get { return this . message ; }
99- set { this . message = value ; }
100- }
89+ public string ? Message { get ; } = string . Empty ;
10190
10291 /// <summary>
10392 /// Gets or sets the class name that threw the error
10493 /// </summary>
105- public string ClassName
106- {
107- get { return this . className ; }
108- set { this . className = value ; }
109- }
94+ public string ? ClassName { get ; }
11095
96+ // TODO: (JimEvans) Change this to return an Image.
11197 /// <summary>
11298 /// Gets or sets the screenshot of the error
11399 /// </summary>
114- public string Screenshot
115- {
116- // TODO: (JimEvans) Change this to return an Image.
117- get { return this . screenshot ; }
118- set { this . screenshot = value ; }
119- }
100+ public string ? Screenshot { get ; }
120101
121102 /// <summary>
122103 /// Gets or sets the stack trace of the error
123104 /// </summary>
124- public StackTraceElement [ ] ? StackTrace
125- {
126- get { return this . stackTrace ; }
127- set { this . stackTrace = value ; }
128- }
105+ public StackTraceElement [ ] ? StackTrace { get ; }
129106 }
130107}
0 commit comments