Forward POSTGRES ERROR to ODK

Hi!

I have a form where city and date should be a primary key for a measurment. As it is impossible to ensure that with ODK I changed those 2 columns to a primary key within the database.

Now, when I'm trying to add a measurment for city and date combination that already exists the data are correctly NOT inserted and a message appears with Internal Server Error 500.
My question is if it is possible to forward the postgres error message (Primary Key constraint violation) to ODK, because Internal Server Error 500 could be everything (e.g. tomcat not running)?

My aim is to tell the user, that a record for that combination of city and date already exists.

Hi @bm! ODK Collect supports custom messaging on submission. The format is described at https://docs.opendatakit.org/openrosa-form-submission/#server-response-format. Customize your server to provide that response and Collect will display it.

Thank you for the answer. After reading the docs, I don't know actually where to customize odk aggregate in order that another response message is returned. Could you give me please some advice?

I'm assuming you are using Aggregate? You will have to download the code at https://github.com/opendatakit/aggregate and find out where that response is set. This might be a good PR to send into Aggregate!