modify exception messages in postgresql

0

How can I change the messages generated by postgresql by default. Example errorcode 42501 permission denied for relation users what errorcode 42501 does not have permissions

    
asked by user66364 15.11.2017 в 17:33
source

1 answer

0

You should create a try-catch structure in the functions you use to capture the errors and display a personalized message for each case if you do not want the default exception to come out (This example is done in java to give an example of the structure):

try{
    //Hacemos una query para recoger categorías(por ejemplo)

catch(Exception e){
    //Mensaje personalizado
    System.err.println("Ha sucedido un error al recoger categorías");
    //Mensaje Generico
    e.printStackTrace();
}
    
answered by 15.11.2017 в 18:08