Skip to content

More detailed JSON Decoding error message #24

@nashysolutions

Description

@nashysolutions

The feedback for corrupt or unexpected data is lacking.

struct EditPoll: Codable, Equatable {
    let name: String
    let description: String
    let duration: Int
    let roomId: UUID
}

Route(.case(PollsRoute.create)) {
    Method.post
    Body(.json(EditPoll.self))
}

error: The data couldn’t be read because it isn’t in the correct format.

I think the following would print more specific information.

print(String(describing: jsonDecodingError))
``

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions