Each uncaught exception in POS is presented in the message window and saved in the log file. The window displays an error’s title and its content. If an exception is of the System.Exception type or inherits from it, the error’s title will be the exception type, while its content will be its Message. The log file saves information on the exception type, the Message’s text and the call stack. It is not the most elegant solution, though, since users should not be deterred by odd titles such as NullReferenceException.
To solve that, you may make use of the Comarch.POS.Library.Errors.RetailException class. The class inherits from System.Exception and introduces two additional properties, predefined by default. These properties are UITitle, used to present error titles, and UIMessage, used to present more user-friendly content. Of course, this content is localized and provided in languages supported by POS. In turn, the log file invariably records the type of an exception, its original content, and call stack. To set a custom title and/or content, create a new exception type inheriting from the RetailException class and overload appropriate properties.
There is a number of exception types derived from RetailException in POS. The table below presents some of them, along with their UITitle and UIMessage content for English.
Exception type | UITitle | UIMessage |
---|---|---|
RetailException | System error | An unknown error occurred |
RetailSecurityException | Access denied | An unknown error occurred |
RetailVoucherException | Handling of vouchers | An unknown error occurred |
RetailVoucherBlockedException | Handling of vouchers | A voucher number {0} is blocked. |