Difference between revisions of "Dbo.uspLogError (procedure)"
| Line 76: | Line 76: | ||
| '''procedure | | '''procedure | ||
| dbo.uspLogError | | dbo.uspLogError | ||
| − | |- | + | |- valign="top" |
| '''Description | | '''Description | ||
| Line 154: | Line 154: | ||
| '''Object Type | | '''Object Type | ||
| '''Dependency Type | | '''Dependency Type | ||
| − | + | ||
|- | |- | ||
| [[dbo.ErrorLog_(table)|dbo.ErrorLog]] | | [[dbo.ErrorLog_(table)|dbo.ErrorLog]] | ||
| Line 171: | Line 171: | ||
| '''Object Type | | '''Object Type | ||
| '''Reference Type | | '''Reference Type | ||
| − | + | ||
|- | |- | ||
| [[HumanResources.uspUpdateEmployeeHireInfo_(procedure)|HumanResources.uspUpdateEmployeeHireInfo]] | | [[HumanResources.uspUpdateEmployeeHireInfo_(procedure)|HumanResources.uspUpdateEmployeeHireInfo]] | ||
| Line 188: | Line 188: | ||
| Table | | Table | ||
| Execute | | Execute | ||
| + | | Trigger | ||
| + | | iWorkOrder | ||
|- | |- | ||
| [[Production.WorkOrder_(table)|Production.WorkOrder]] | | [[Production.WorkOrder_(table)|Production.WorkOrder]] | ||
| Table | | Table | ||
| Execute | | Execute | ||
| + | | Trigger | ||
| + | | uWorkOrder | ||
|- | |- | ||
| [[Purchasing.PurchaseOrderDetail_(table)|Purchasing.PurchaseOrderDetail]] | | [[Purchasing.PurchaseOrderDetail_(table)|Purchasing.PurchaseOrderDetail]] | ||
| Table | | Table | ||
| Execute | | Execute | ||
| + | | Trigger | ||
| + | | iPurchaseOrderDetail | ||
|- | |- | ||
| [[Purchasing.PurchaseOrderDetail_(table)|Purchasing.PurchaseOrderDetail]] | | [[Purchasing.PurchaseOrderDetail_(table)|Purchasing.PurchaseOrderDetail]] | ||
| Table | | Table | ||
| Execute | | Execute | ||
| + | | Trigger | ||
| + | | uPurchaseOrderDetail | ||
|- | |- | ||
| [[Purchasing.PurchaseOrderHeader_(table)|Purchasing.PurchaseOrderHeader]] | | [[Purchasing.PurchaseOrderHeader_(table)|Purchasing.PurchaseOrderHeader]] | ||
| Table | | Table | ||
| Execute | | Execute | ||
| + | | Trigger | ||
| + | | uPurchaseOrderHeader | ||
|- | |- | ||
| [[Purchasing.Vendor_(table)|Purchasing.Vendor]] | | [[Purchasing.Vendor_(table)|Purchasing.Vendor]] | ||
| Table | | Table | ||
| Execute | | Execute | ||
| + | | Trigger | ||
| + | | dVendor | ||
|- | |- | ||
| [[Sales.SalesOrderDetail_(table)|Sales.SalesOrderDetail]] | | [[Sales.SalesOrderDetail_(table)|Sales.SalesOrderDetail]] | ||
| Table | | Table | ||
| Execute | | Execute | ||
| + | | Trigger | ||
| + | | iduSalesOrderDetail | ||
|- | |- | ||
| [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]] | | [[Sales.SalesOrderHeader_(table)|Sales.SalesOrderHeader]] | ||
| Table | | Table | ||
| Execute | | Execute | ||
| + | | Trigger | ||
| + | | uSalesOrderHeader | ||
|- | |- | ||
| [[Sales.Store_(table)|Sales.Store]] | | [[Sales.Store_(table)|Sales.Store]] | ||
| Table | | Table | ||
| Execute | | Execute | ||
| + | | Trigger | ||
| + | | iStore | ||
|} | |} | ||
Revision as of 06:26, 30 November 2009
wikibot
| procedure | dbo.uspLogError |
-- uspLogError logs error information in the ErrorLog table about the
-- error that caused execution to jump to the CATCH block of a
-- TRY...CATCH construct. This should be executed from within the scope
-- of a CATCH block otherwise it will return without inserting error
-- information.
CREATE PROCEDURE [dbo].[uspLogError]
@ErrorLogID [int] = 0 OUTPUT -- contains the ErrorLogID of the row inserted
AS -- by uspLogError in the ErrorLog table
BEGIN
SET NOCOUNT ON;
-- Output parameter value of 0 indicates that error
-- information was not logged
SET @ErrorLogID = 0;
BEGIN TRY
-- Return if there is no error information to log
IF ERROR_NUMBER() IS NULL
RETURN;
-- Return if inside an uncommittable transaction.
-- Data insertion/modification is not allowed when
-- a transaction is in an uncommittable state.
IF XACT_STATE() = -1
BEGIN
PRINT 'Cannot log error since the current transaction is in an uncommittable state. '
+ 'Rollback the transaction before executing uspLogError in order to successfully log error information.';
RETURN;
END
INSERT [dbo].[ErrorLog]
(
[UserName],
[ErrorNumber],
[ErrorSeverity],
[ErrorState],
[ErrorProcedure],
[ErrorLine],
[ErrorMessage]
)
VALUES
(
CONVERT(sysname, CURRENT_USER),
ERROR_NUMBER(),
ERROR_SEVERITY(),
ERROR_STATE(),
ERROR_PROCEDURE(),
ERROR_LINE(),
ERROR_MESSAGE()
);
-- Pass back the ErrorLogID of the row inserted
SET @ErrorLogID = @@IDENTITY;
END TRY
BEGIN CATCH
PRINT 'An error occurred in stored procedure uspLogError: ';
EXECUTE [dbo].[uspPrintError];
RETURN -1;
END CATCH
END;
automatically generated
| procedure | dbo.uspLogError |
| Description | Logs error information in the ErrorLog table about the error that caused execution to jump to the CATCH block of a TRY...CATCH construct. Should be executed from within the scope of a CATCH block otherwise it will return without inserting error information. |
-- uspLogError logs error information in the ErrorLog table about the
-- error that caused execution to jump to the CATCH block of a
-- TRY...CATCH construct. This should be executed from within the scope
-- of a CATCH block otherwise it will return without inserting error
-- information.
CREATE PROCEDURE [dbo].[uspLogError]
@ErrorLogID [int] = 0 OUTPUT -- contains the ErrorLogID of the row inserted
AS -- by uspLogError in the ErrorLog table
BEGIN
SET NOCOUNT ON;
-- Output parameter value of 0 indicates that error
-- information was not logged
SET @ErrorLogID = 0;
BEGIN TRY
-- Return if there is no error information to log
IF ERROR_NUMBER() IS NULL
RETURN;
-- Return if inside an uncommittable transaction.
-- Data insertion/modification is not allowed when
-- a transaction is in an uncommittable state.
IF XACT_STATE() = -1
BEGIN
PRINT 'Cannot log error since the current transaction is in an uncommittable state. '
+ 'Rollback the transaction before executing uspLogError in order to successfully log error information.';
RETURN;
END
INSERT [dbo].[ErrorLog]
(
[UserName],
[ErrorNumber],
[ErrorSeverity],
[ErrorState],
[ErrorProcedure],
[ErrorLine],
[ErrorMessage]
)
VALUES
(
CONVERT(sysname, CURRENT_USER),
ERROR_NUMBER(),
ERROR_SEVERITY(),
ERROR_STATE(),
ERROR_PROCEDURE(),
ERROR_LINE(),
ERROR_MESSAGE()
);
-- Pass back the ErrorLogID of the row inserted
SET @ErrorLogID = @@IDENTITY;
END TRY
BEGIN CATCH
PRINT 'An error occurred in stored procedure uspLogError: ';
EXECUTE [dbo].[uspPrintError];
RETURN -1;
END CATCH
END;
| Referenced Object | Object Type | Dependency Type |
| dbo.ErrorLog | Table | Insert |
| dbo.uspPrintError | Procedure | Execute |
| Referencing Object | Object Type | Reference Type | ||
| HumanResources.uspUpdateEmployeeHireInfo | Procedure | Execute | ||
| HumanResources.uspUpdateEmployeeLogin | Procedure | Execute | ||
| HumanResources.uspUpdateEmployeePersonalInfo | Procedure | Execute | ||
| Production.WorkOrder | Table | Execute | Trigger | iWorkOrder |
| Production.WorkOrder | Table | Execute | Trigger | uWorkOrder |
| Purchasing.PurchaseOrderDetail | Table | Execute | Trigger | iPurchaseOrderDetail |
| Purchasing.PurchaseOrderDetail | Table | Execute | Trigger | uPurchaseOrderDetail |
| Purchasing.PurchaseOrderHeader | Table | Execute | Trigger | uPurchaseOrderHeader |
| Purchasing.Vendor | Table | Execute | Trigger | dVendor |
| Sales.SalesOrderDetail | Table | Execute | Trigger | iduSalesOrderDetail |
| Sales.SalesOrderHeader | Table | Execute | Trigger | uSalesOrderHeader |
| Sales.Store | Table | Execute | Trigger | iStore |