//@@ERROR is system function return execution status on 0=success, so you can check like below
//code
IF @@ERROR <>0
//do something
ELSE
//do some code
i think it will help you..try and let me know wether it help you or not and also don't forgot to like if you like the answer