SQL Server error handling

CREATE PROCEDURE <procName>
/*^
* Procedure:     usp_TryCatchSkeleton
^*/
AS

BEGIN

   SET NOCOUNT ON

   BEGIN TRY

      --Do work

   END TRY

   BEGIN CATCH
/* Note that catching and rethrowing an exception is a lossy operation. ERROR_PROCEDURE() etc will be reset. */
      DECLARE @errorMessage   NVARCHAR(4000);
      DECLARE @errorSeverity  INT;
      DECLARE @errorState     INT;

      SELECT  @errorMessage   = ERROR_MESSAGE(),
              @errorSeverity  = ERROR_SEVERITY() ,
              @errorState     = ERROR_STATE();

      --Perform required recovery actions.

      RAISERROR ( @errorMessage, @errorSeverity, @errorState );
      
      RETURN 1;

   END CATCH
   
   RETURN 0;
END
Posted in sql