Recording SQL Server call stack when reporting errors

后端 未结 2 1930
暗喜
暗喜 2020-12-18 03:35

This is a follow up to the question Nested stored procedures containing TRY CATCH ROLLBACK pattern?

In the catch block I use a stored procedure to report (reraise) t

2条回答
  •  暖寄归人
    2020-12-18 04:25

    A limited answer to this would be to pass OBJECT_NAME(@@PROCID) to the ReportError procedure - when ReportError detects that it is receving a recursive error (an error thrown by itself), it can use this value and append it to the error message, providing a partial stack trace (stack trace won't have line numbers except for the first element)

提交回复
热议问题