Hi Rahul,
I had switched the exceptions position and it worked how you want. But in this case, if you have any other exception it will throw "Record Already Exist" error message only.
Alternate solution is to check whether the entered name/ID already exist into the entity or not before inserting new row and if combination of both exist simply through the message and do an exit from their.
Please try and let me know, if this help you.

Thanks & Regards,
Sachin