Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 909 Bytes

MissingCodeTryCatchEx.md

File metadata and controls

39 lines (29 loc) · 909 Bytes

Missing code in Raise block in "Try ... Raise ... EndTry" (MissingCodeTryCatchEx)

Description

It is unacceptable to catch any exception, without any trace for system administrator.

Incorrect

Try
    // code causing exception
    ....
Raise // catch any exception
EndTry;

As a rule, such a design hides a real problem, which is subsequently impossible to diagnose.

Correct

Try
    // code causing exception
    ....
Raise
    // Explanation why catching all exceptions untraceable for enduser.
    // ....
    // Write to log for system administrator.
    WriteLogEvent(NStr("en = 'Action'"),
       EventLogLevel.Error,,,
       DetailErrorDescription(ErrorInfo()));
EndTry;

Sources