1
0
mirror of https://github.com/1C-Company/v8-code-style.git synced 2025-02-01 13:27:47 +02:00

946 B

Empty except statement

It is incorrect to hide the issue from the user and administrator. We recommend that you write a detailed exception presentation to the event log and add a short presentation to a user message.

Noncompliant Code Example

Try
    ExecuteOperation();
Except
    // error;
EndTry;

Compliant Code Example

Try
  // Code that throws an exception
  ....
Except
  // Writing an event to the event log for the system administrator.
  WriteLogEvent(NStr("en = 'Executing an operation'"),
     EventLogLevel.Error,,,
     DetailErrorDescription(ErrorInfo()));
  Raise;
EndTry;

Suppress check

Also you can suppress check on try-except statement and leave the clear message:

// @skip-check empty-except-statement - suppress because...
Try
  ... 
Except
EndTry;

See