|(5 intermediate revisions by 2 users not shown)|
petra every error message has got a code which helps to identify a messsage. In openpetra this is a little bit more important because here the message may be translated and unclear. The object TVerificationResultCollection for example provides a file named AResultCode and this may be one good position to place it. |+|
In every error message has got code which helps to identify a . In this is more importantbecause the message may be translated and unclear . The a .
| || |
|−|The task of this side is either to provide a ticket system which guarantees that a code is unique and it provides the start page for enhanced service information. As it was done in petra, in openpetra we will handle a code containing two parts, the name of the module and a running number. Each code number which is used by open petra has to be listed here includig a short description. Later - if necessary - a link to a more detailed page can be added. |+|
and .in , in codethe of the .code.
| || |
|−|The error number contains of a module name like MODULE and a running number like MODULE. 01 or else. |+|
of a a ..
| || |
|−|== Error Codes Example == |+|
| || |
|−|* EXCAMPLE | |
|−|** EXCAMPLE.01: Message ... | |
|−|** EXCAMPLE.02: [The message example.02] | |
| || |
|−|Please join the code and the number correctly at the first part of the line. This helps a user to find the information by using the search function. And the message itelf can contain a link o an other page. please do not use more than a line for the description. |+|
the to use the .
| || |
== Error Codes ==
Latest revision as of 23:13, 2 March 2013
Objective of Error Codes
In Petra 2.x, every error message has got an error code which helps to identify a message. In openPETRA this is even more important, because in openPETRA the message text and message title may be translated into any language and its meaning will be unclear to support staff who don't speak the language the message is shown in. The only way they can identify the error message in such a case is by looking up the error code.
Declarations of Error Codes
Error Code declarations can exist throughout OpenPetra (anywhere in Ict.Common* and Ict.Petra.Shared*, in theory). However, Error Code Namespaces need to be 'registered' in order for them to be used in the OpenPetra application. That happens at the startup of PetraClient (in Method '
Ict.Petra.Client.App.PetraClient.TPetraClientMain.StartUp') and PetraServer (in the Constructor of the '
Error Codes are deliberately allowed to be declared in several different Namespaces for maximum flexibility and to allow declaration of ErrorCodes close to the context in which they are used. Through that it is possible for several Namespaces to contain various (unique) Error Codes, also ones in the same group (e.g. 'GENC.*'). An example for that is the '
GENC.0017V' Error Code found in
\csharp\ICT\Common\StringChecks.cs. All other Error Codes in the 'GENC.*' group are defined in
\csharp\ICT\Common\ErrorCodes.cs, but this one is defined in a different Namespace to place it close to the context where it is used. (It is a good idea to put a comment into the place where many Error Codes are defined (e.g.
ErrorCodes.cs), pointing to locations outside of that Class where other Error Codes of the same group are defined. Example:
GENC.0017V Error Code).
At the point of writing this documentation, Error Codes are defined in the following Namespaces:
Ict.Common.CommonErrorCodes (in file
Ict.Common.Ict.Common.Verification.TStringChecks (in file
Ict.Petra.Shared.PetraErrorCodes (in file
Uniqueness of Error Codes
Error Codes need to be unique in the whole OpenPetra application to prevent that different Errors or Warning would use the same Error Code.
Automated Check for the Uniqueness of Error Codes
To uncover any duplicate Error Codes declarations across all Namespaces in which they are registered, a NUnit Test exists -
Ict.Common.Testing.TTestCommon.TestErrorCodesUniqueAcrossOpenPetra. That NUnit Test will fail if duplicate Error Codes are defined in any of the 'registered' Namespaces, so duplicates will be automatically uncovered in this way.
Error Code Handling in openPETRA
The object TVerificationResult provides the Property 'ResultCode'. The error code of a particular error needs to be assigned to this property.
When an error message is displayed, e.g. in a MessageBox, the 'ResultCode' is to be displayed in a separate line at the end of the message.
Central Inventory of Error Codes
See the generated list of already existing error codes in OpenPetra: https://ci.openpetra.org/job/OpenPetraCodeDoc/doclinks/1/