Exceptions for mysql

Hello all,

I need help for implement proper exception or error handling for mysql ,please let me know how i can achieve it.

Adonis uses a global exception handler. Can you provide example code where you are lacking the exception handling you need?

Hi Jacksoncharles,

try {

       const Qualifications = 
       
       await Database
       .from('sp_qualifications')
       .whereIn('sp_qualifications.id',
        Database
       .table('sp_students_qualifications')
       .where('sp_students_qualifications.student',id)
       .where('sp_students_qualifications.active',1)
       .distinct('sp_students_qualifications.qualification as id')
       );
        return response.status(200).json(Qualifications)
     }catch(error ) {
      let data = {
          message:error
      }
      return response.status(500).json(data)
     }

i m not getting proper errors on catch block.

What’s the error you get and what’s the error you are expecting?