Add detail to InvalidOperationException in Exception Handler Middleware (#22858)

This commit is contained in:
Scott Addie 2020-06-15 13:31:23 -05:00 committed by GitHub
parent fadca381b8
commit 11fb7b67d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -248,7 +248,7 @@
<value>Environment:</value>
</data>
<data name="ExceptionHandlerOptions_NotConfiguredCorrectly" xml:space="preserve">
<value>An error occurred when configuring the exception handler middleware. Either the 'ExceptionHandlingPath' or the 'ExceptionHandler' option must be set in 'UseExceptionHandler()'.</value>
<value>An error occurred when configuring the exception handler middleware. Either the 'ExceptionHandlingPath' or the 'ExceptionHandler' property must be set in 'UseExceptionHandler()'. Alternatively, set one of the aforementioned properties in 'Startup.ConfigureServices' as follows: 'services.Configure&lt;ExceptionHandlerOptions&gt;(options =&gt; { ... });'.</value>
</data>
<data name="ErrorPageHtml_NoRouteValues" xml:space="preserve">
<value>No route values.</value>
@ -280,4 +280,4 @@
<data name="ErrorPageHtml_NameColumn" xml:space="preserve">
<value>Name</value>
</data>
</root>
</root>

View File

@ -406,8 +406,9 @@ namespace Microsoft.AspNetCore.Diagnostics
var exception = Assert.Throws<InvalidOperationException>(() => new TestServer(builder));
// Assert
Assert.Equal($"An error occurred when configuring the exception handler middleware. " +
$"Either the 'ExceptionHandlingPath' or the 'ExceptionHandler' option must be set in 'UseExceptionHandler()'.",
Assert.Equal("An error occurred when configuring the exception handler middleware. " +
"Either the 'ExceptionHandlingPath' or the 'ExceptionHandler' property must be set in 'UseExceptionHandler()'. " +
"Alternatively, set one of the aforementioned properties in 'Startup.ConfigureServices' as follows: 'services.Configure<ExceptionHandlerOptions>(options => { ... });'.",
exception.Message);
}
}