32.3.7. Setting up error processing


<< Prev   Next >>

To set up error processing, use the ErrorProcessingSettings object. You can set up error processing for all users at once or for a particular user. To set up error processing for all users, use the ErrorProcessing.GetCommonSettings() and ErrorProcessing.SetCommonSettings() methods. To set up error processing for a particular user, use the ErrorProcessing.GetUserSettings() and ErrorProcessing.SetUserSettings() methods. In both cases, the error processing settings are the same. Different settings define the system behavior depending on whether an error occurs in the client application or in the server application. As a rule, the only difference is in the suffix: AtClient for an error in the client application or AtServer for an error in the server application. Hereinafter such settings will not be described separately except for some cases.

The following settings are available:

  • ErrorProcessingServiceAddress. Use it to specify the service that will be used for automatic error registration.
  • MessageDisplayVariant. Use it to configure the error message appearance:
    • StandardErrorMessageForUser. In this case, the result of the ErrorProcessing.StandardErrorMessageForUser() method is displayed.
    • BriefErrorDescription. In this case, the result of the ErrorProcessing.BriefErrorDescription() method is displayed.
    • DetailErrorDescription. In this case, the result of the ErrorProcessing.DetailErrorDescription() method is displayed.
    • Auto. In the error processing settings, it is interpreted as follows:
      • In version 8.3.16 and earlier compatibility mode: as the BriefErrorDescription value.
      • In other cases: as the ErrorMessageForUser value.
  • IncludeUserNameInReportOnClient, IncludeUserNameInReportOnServer. Includes the current user name in the error report.
  • IncludeSystemInfoInReportOnClient. Includes system information about the client computer in the error report.
  • IncludeWindowsScreenshotInReportOnClient. Includes application screenshots in the error report.
  • IncludeDetailErrorDescriptionInReportOnClient, IncludeDetailErrorDescriptionInReportOnServer. Includes a detailed error text in the error report.
  • IncludeInfobaseInformationInReportOnClient, IncludeInfobaseInformationInReportOnServer. Includes infobase information (configuration, extensions, and server) in the error report.
  • AdditionalReportInformation. Use it to specify arbitrary additional information that will be added to the report. If there is an empty string in the settings for the user, the parameter value will be received from the general settings. This string may contain the name/code of the infobase and/or area, or any other information specified by the developer.
  • SendReportOnClient. Automatically sends an application error report to the service whose address is specified in the ErrorProcessingServiceAddress property.
  • SendReportOnServer. Automatically sends an application error report to the service whose address is specified in the ErrorProcessingServiceAddress property. The setting is intended for errors that cannot be processed in the client application.
  • SendCrashReportOnClient. SendCrashReportOnServer. Automatically sends an error report when the client application is abnormally terminated to the service specified in the ErrorProcessingServiceAddress property.
  • SendCrashReportOnClientToPlatformErrorRegistrationService, SendCrashReportOnServerToPlatformErrorRegistrationService. Automatically sends an error report when the client application is abnormally terminated to 1C:Remote service: https://pult.1c.com/pult/platform/errors. To disable interaction with this service, specify the ErrorReportingMode.DontSend value in this property.
  • ErrorMessagesTexts. Use it to set error text templates.

Use the ErrorMessagesTexts property to set an error presentation for the user. This property is a collection of elements of the KeyAndValue type. The value of the ErrorCategory type is the key. The value of the ErrorMessageTexts type is the key. An object of the ErrorMessagesTexts type does not have its own constructor. You can receive it only from the error processing settings.

Use the ErrorMessagesTexts object to specify the following texts:

  • Text for a recoverable error (the RestartNotRequiredErrorText object property).
  • Text for a non-recoverable error (the RestartRequiredErrorText object property).

The message text must include user-friendly information. It may have one or more standard error presentations. The standard error presentation is an error presentation that is generated by the corresponding platform method. So you cannot change the error text generated by the platform. You can change the text that the user will see.

Consider the example: assume that for all the errors called by the Raise operator, you need to display text Unexpected error. Contact the configuration developer., and not to display the error text itself. First of all, let's decide on how the error displayed by the platform will look like if you write the code of the Raise "Error from 1C:Enterprise language"; kind in 1C:Enterprise language:

Fig. 626. Default message

If you execute the following code in 1C:Enterprise language:

Settings = ErrorProcessing.GetUserSettings();
Settings.ErrorMessagesTexts.Clear();
Text = New ErrorMessageTexts("Unexpected error. Call the developers by internal phone 1234!", "");
Settings.ErrorMessagesTexts.Insert(ErrorCategory.ExceptionRaisedFromScript, Text);
ErrorProcessing.SetUserSettings(Settings);

and restart the client application, then the same exception will look as follows:

Fig. 627. New error message

However, in addition to the replacement of the whole message text, you may need a combination of the standard platform error message text and an additional text. For this, the platform provides several parameters that you can insert in the message text:

Parameter name

Description

BriefErrorDescription

Contains the result of the ErrorProcessing.BriefErrorDescription() method.

DetailErrorDescription

Contains the result of the ErrorProcessing.DetailErrorDescription() method.

ErrorDescriptionForUser

Contains the result of the ErrorProcessing.ErrorDescriptionForUser() method.

StandardErrorMessageForUser

Contains the result of the ErrorProcessing.StandardErrorMessageForUser() method. When the system generates a message, it uses the standard platform template, and not the text that is currently set in the error processing settings.

The parameter text is placed in the message text in square brackets []. So, if you want to add the full error text to the message, use the following code:

Settings = ErrorProcessing.GetUserSettings();
Settings.ErrorMessagesTexts.Clear();
Text = New ErrorMessageTexts("Unexpected error. Call the developers by internal phone 1234!" + Symbols.LF + "[ПодробноеПредставлениеОшибки]", "");
Settings.ErrorMessagesTexts.Insert(ErrorCategory.ExceptionRaisedFromScript, Text);
ErrorProcessing.SetUserSettings(Settings);

After you execute this code and restart the client application, the error text will look as follows:

Fig. 628. Error message with platform text

You cannot always set up the behavior of the error processing system when you develop an application. For example, you may want to add contact details of a particular company's support personnel to error texts. Obviously, the application developer knows neither about your idea nor the contact details of this support. So, in the platform, you can configure error messages in 1C:Enterprise mode. To do this, use the standard Management of error processing settings function.

<< Prev   Next >>

Icon/Social/001 Icon/Social/006 Icon/Social/005 Icon/Social/004 Icon/Social/002