Skip to content

Do not return 409 for InvalidCastException #313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jaredcnance opened this issue Jun 27, 2018 · 0 comments
Closed

Do not return 409 for InvalidCastException #313

jaredcnance opened this issue Jun 27, 2018 · 0 comments
Labels

Comments

@jaredcnance
Copy link
Contributor

This should be handled explictly and we should not assume any InvalidCastException should return 409. Often times this is a 500 error.

// TODO: this is for mismatching type requests (e.g. posting an author to articles endpoint)
// however, we can't actually guarantee that this is the source of this exception
// we should probably use an action filter or when we improve the ContextGraph
// we might be able to skip most of deserialization entirely by checking the JToken
// directly
if (exceptionType == typeof(InvalidCastException))
return new JsonApiException(409, exception.Message, exception);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant