Skip to content

Conversation

itrofimow
Copy link

Adresses #147

@dnfclas
Copy link

dnfclas commented Aug 8, 2018

CLA assistant check
All CLA requirements met.

@dougbu
Copy link
Contributor

dougbu commented Aug 16, 2018

@Tratcher I would appreciate you giving this a look. Seems reasonable to me though it adds a few more overloads to the public surface. Any concerns?

Copy link
Member

@Tratcher Tratcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests?

catch (Exception exception)
{
if (_rethrowExceptions)
throw;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: include the braces please.

{
public class CorsMessageHandlerTest
{
private class PassthroughExceptionHandler : IExceptionHandler
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feels like it's not the best place for this class, however i have no idea where it should be placed(
Any suggestions would be appreciated

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bottom of this class is fine.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

{
HttpConfiguration config = new HttpConfiguration();
config.Routes.MapHttpRoute("default", "{controller}");
config.Services.Replace(typeof(IExceptionHandler), new PassthroughExceptionHandler());
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed to reproduce the exact scenario of original issue, otherwise default implementation of IExceptionHandler maps Exceptions to just 500 status code

@itrofimow
Copy link
Author

I added tests and braces.

Copy link
Contributor

@dougbu dougbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small change, then we sit for a couple of days

{
public class CorsMessageHandlerTest
{
private class PassthroughExceptionHandler : IExceptionHandler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bottom of this class is fine.

public static void EnableCors(this HttpConfiguration httpConfiguration)
{
EnableCors(httpConfiguration, null);
EnableCors(httpConfiguration, null, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI we've got a meeting scheduled next Tuesday to decide whether default should be true i.e. whether we should break compatibility to ensure IExceptionHandler sees what it should. Will let you know…

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision was to avoid breaking changes and stick with the approach you've implemented here.

Copy link
Contributor

@dougbu dougbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we stick with swallow-exceptions-by-default, this is ready to go.

@dougbu dougbu merged commit 8044f4e into aspnet:master Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants