Please visit SQLVERSITY.COM for more details.
So by using RAISERROR function, we can overwrite the error message in a meaningful way.
———————————————————————————————————————
BEGIN TRY
DECLARE @RaiserrorDemo INT
SET @RaiserrorDemo = 8/0
END TRY
BEGIN CATCH
RAISERROR (‘Divided by zero exception. We can not divide a number with zero.’, 16, 1)
— 16 — Error Severity
— 1 — Error state
END CATCH
GO
———————————————————————————————————————
Error Raised by the above ex:
Msg 50000, Level 16, State 1, Line 9
Divided by zero exception. We can not divide a number with zero.
———————————————————————————————————————
For more information about RAISERROR, Click here