Question : what goes first the error code for the rollback

Hello,

I'm implementing error trapping code in my stored procedures.  Some of my procedures have multiple statemets and so I'm defining transaction boundaries for those those stored procedures.  In those cases, in the catch block, does the ROLLBBACK TRAN go after the EXEC dbo.usp_err_messages for before it.  I'm thinking that in the catch block, the error message is generated and then the transaction is rolled back.  Is my order correct
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
ALTER Procedure [dbo].[up_InsertNormalizedData]
AS
BEGIN TRAN
	BEGIN TRY
		/* This procedure loads the InputNems table with normalized data from the ImportData table.  The data is normalized
		via stored procedure up_NormalizedData.  In addition, the normalized date in the InputNems table is then
		loaded into the FormattedInputNEMS table where the TSCF field is parsed into the Type, Sector, Category, and FuelType
		fields via up_ParseField*/

		TRUNCATE TABLE dbo.InputNems

		INSERT INTO dbo.InputNEMS (Run, Region ,TSCF, MetricValue, ForecastYear )
		exec dbo.up_NormalizeData

		TRUNCATE TABLE dbo.FormattedInputNEMS

		INSERT INTO dbo.FormattedInputNEMS (Run, Region , TSCF , MetricValue , ForecastYear )
		SELECT Run , Region , TSCF , MetricValue , ForecastYear 
		FROM dbo.InputNEMS ;

		EXEC dbo.up_ParseField

		COMMIT TRAN
	END TRY
	
	BEGIN CATCH
		EXEC dbo.usp_err_messages 
		ROLLBACK TRAN
	END CATCH

Answer : what goes first the error code for the rollback

new Random().nextDouble() * (MAX - MIN) + MIN
Random Solutions  
 
programming4us programming4us