Skip to content
Advertisement

PostgreSQL, Java : How to print jast the RAISE EXCEPTION message without info about the place in the code?

This is my java method:

This is my PostgreSQL function:

When the exception is thrown, I get such a message dialog: [image]1

Error message is gotten when I try to register and the username I put already exists. So I get the alert “Username is taken by someone, try else” (1 line on the screenshot). And I want to print only these words, without this second line on the screenshot.

How can I get rid of this second line?

Advertisement

Answer

Use String.split() to split tne exception message and print what needed.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement