Skip to content

Commit

Permalink
Make exception message for DevTools GetVersionSpecificDomains<T> meth…
Browse files Browse the repository at this point in the history
…od explicit
  • Loading branch information
jimevans committed Nov 10, 2020
1 parent 11c02ce commit 4b7429f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dotnet/src/webdriver/DevTools/DevToolsSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ public T GetVersionSpecificDomains<T>() where T: DevToolsSessionDomains
T versionSpecificDomains = this.domains.VersionSpecificDomains as T;
if (versionSpecificDomains == null)
{
throw new InvalidOperationException("Type is invalid for conversion");
string errorTemplate = "The type is invalid for conversion. You requested domains of type '{0}', but the version-specific domains for this session are '{1}'";
string exceptionMessage = string.Format(CultureInfo.InvariantCulture, errorTemplate, typeof(T).ToString(), this.domains.GetType().ToString());
throw new InvalidOperationException(exceptionMessage);
}

return versionSpecificDomains;
Expand Down

0 comments on commit 4b7429f

Please sign in to comment.