Simplify integrity error

Simplify integrity error

we0038we0038 Posts: 39Questions: 13Answers: 1

How simplify long integrity error e.g.
An SQL error occurred: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (......, CONSTRAINT ...... FOREIGN KEY (...... ) REFERENCES ...... (...... ) ON DELETE NO ACTION ON UPDATE NO ACTION)

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    Answer ✓

    Do you mean you want to not show that error message to the end user?

    If you use postSubmit you can check for an error parameter in the returned JSON and modify it as you need there.

    Another option is to apply a suitable validator to the Editor instance to not let it get that far that the SQL generated will fail.

    Allan

  • we0038we0038 Posts: 39Questions: 13Answers: 1

    I still want to show a short error massage.
    postSubmit sounds a good idea. for now I just used i18n which overrides the long error message.

This discussion has been closed.