Skip to content

Do not return 409 for InvalidCastException  #313

Closed
@jaredcnance

Description

@jaredcnance

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions