Skip to content

SQL errors can be conveyed as part of the HTTP response #1895

@vemv

Description

@vemv

This is a sample response

   "error-details": {
        "result": {
            "success?": false,
            "reason": "exception",
            "error-details": {
                "msg": "Batch entry 0 DELETE FROM \"stakeholder\"\nWHERE id = ('10080'::int8) was aborted: ERROR: update or delete on table \"stakeholder\" violates foreign key constraint \"stakeholder_badge_stakeholder_id_fkey\" on table \"stakeholder_badge\"\n  Detail: Key (id)=(10080) is still referenced from table \"stakeholder_badge\".  Call getNextException to see other errors in the batch."
            }
        }
    }
}

A solution which would follow recent patterns would be to add 500 {:body (failure-with :reason any?)} in all places - this way Malli will take care of trimming away everything that isn't a :reason

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