[dotnet] add additional context info to unexpected errors in responses
@@ -573,7 +573,7 @@ protected virtual Response Execute(string driverCommandToExecute, Dictionary<str
if (commandResponse.Status != WebDriverResult.Success)
{
- UnpackAndThrowOnError(commandResponse);
+ UnpackAndThrowOnError(commandResponse, driverCommandToExecute);
}
return commandResponse;
@@ -684,7 +684,7 @@ protected virtual void Dispose(bool disposing)
this.executor.Dispose();
}
- private static void UnpackAndThrowOnError(Response errorResponse)
+ private static void UnpackAndThrowOnError(Response errorResponse, string commandToExecute)
{
// Check the status code of the error, and only handle if not success.
if (errorResponse.Status != WebDriverResult.Success)
@@ -793,7 +793,7 @@ private static void UnpackAndThrowOnError(Response errorResponse)
}
else
{
- throw new WebDriverException("Unexpected error. " + errorResponse.Value.ToString());
+ throw new WebDriverException("The " + commandToExecute + " command returned an unexpected error. " + errorResponse.Value.ToString());
}
}
}
