Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Open
vemv opened this issue Mar 25, 2024 · 0 comments
Open

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

vemv opened this issue Mar 25, 2024 · 0 comments

Comments

@vemv
Copy link
Collaborator

vemv commented Mar 25, 2024

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant