postgresql - What is the MySQL equivalent of PSQLException -


i trying move database , web app postgresql mysql, application using play 2.3.0.

i made app work mysql haven't yet made error management, i'll need there:

the original code uses psqlexception this:

import org.postgresql.util.psqlexception  try {       sql("delete lab id = {id}")         .on("id" -> lab.id)         .executeupdate()       true     } catch {       case e: psqlexception         if e.getmessage.contains("update or delete on table \"lab\" violates foreign key constraint \"conference_organizedby_fkey\" on table \"conference\"") |            e.getmessage.contains("update or delete on table \"lab\" violates foreign key constraint \"appuser_lab_fkey\" on table \"appuser\"")         => logger.warn(e.getservererrormessage.getmessage); false     } 

i don't find mysql error handler best type of error.

what think should use?

just catch sqlexception, of psqlexception implementation, , stick methods - namely getmessage()

unless really need info psqlexception provides, better not know actual class of exception, because invisibly binding handler jdbc connection path.


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

android - MPAndroidChart - How to add Annotations or images to the chart -