@@ -183,33 +183,9 @@ internal static class WebDriverError
183
183
/// </summary>
184
184
public const string UnsupportedOperation = "unsupported operation" ;
185
185
186
- private static Dictionary < string , WebDriverResult > resultMap ;
187
- private static object lockObject = new object ( ) ;
186
+ private static readonly Dictionary < string , WebDriverResult > resultMap ;
188
187
189
- /// <summary>
190
- /// Converts a string error to a <see cref="WebDriverResult"/> value.
191
- /// </summary>
192
- /// <param name="error">The error string to convert.</param>
193
- /// <returns>The converted <see cref="WebDriverResult"/> value.</returns>
194
- public static WebDriverResult ResultFromError ( string error )
195
- {
196
- lock ( lockObject )
197
- {
198
- if ( resultMap == null )
199
- {
200
- InitializeResultMap ( ) ;
201
- }
202
- }
203
-
204
- if ( ! resultMap . ContainsKey ( error ) )
205
- {
206
- error = UnsupportedOperation ;
207
- }
208
-
209
- return resultMap [ error ] ;
210
- }
211
-
212
- private static void InitializeResultMap ( )
188
+ static WebDriverError ( )
213
189
{
214
190
resultMap = new Dictionary < string , WebDriverResult > ( ) ;
215
191
resultMap [ ElementClickIntercepted ] = WebDriverResult . ElementClickIntercepted ;
@@ -244,5 +220,20 @@ private static void InitializeResultMap()
244
220
resultMap [ UnknownMethod ] = WebDriverResult . UnknownCommand ;
245
221
resultMap [ UnsupportedOperation ] = WebDriverResult . UnhandledError ;
246
222
}
223
+
224
+ /// <summary>
225
+ /// Converts a string error to a <see cref="WebDriverResult"/> value.
226
+ /// </summary>
227
+ /// <param name="error">The error string to convert.</param>
228
+ /// <returns>The converted <see cref="WebDriverResult"/> value.</returns>
229
+ public static WebDriverResult ResultFromError ( string error )
230
+ {
231
+ if ( ! resultMap . ContainsKey ( error ) )
232
+ {
233
+ error = UnsupportedOperation ;
234
+ }
235
+
236
+ return resultMap [ error ] ;
237
+ }
247
238
}
248
239
}
0 commit comments