When developing code-based customizations using Telligent Community, it is important to manage exceptions and process logging appropriately. Telligent Community provides services to enable effective user notification and logging of exceptions and also general process logging.
Table of Contents
Plugins are .net classes and can throw .net exceptions to identify exceptional issues and there are many solutions to process logging. Telligent Community provides support for integrating exception handling and process logging, enabling a consistent error and process handling experience for administrators and community members.
When an exception bubbles up from a plugin to a user, either via UI rendering or when handling a REST request, Telligent Community will interpret the exception to return an error response to the accessing user. To prevent information disclosure security vulnerabilities, exceptions, by default, are replaced with a generic error message in UI and REST responses.
To enable custom messages to be returned, the thrown exception must implement IUserRenderableException. This interface can be applied to a custom
Exception implementation to identify to Telligent Community that the exception can provide an appropriate, safe, and ideally translated message to a user. The interface defines one member,
GetUserRenderableMessage() which returns a string. The results of this method will be returned through the UI and shown to the user or be placed in the
Errors collection of REST responses (depending on how the API, and indirectly the plugin, was accessed).
Some exceptions are caused by user error, for example, entering "abcd" where a number was expected. Other exceptions may identify a configuration issue. Issues that occur that should be reviewed and corrected are good candidates for logging.
Telligent Community includes an exception log (available in Administration > Monitoring > Exceptions) and custom exceptions can be logged there as well by implementing ILoggableException on the
Exception being thrown. Any exception that bubbles up to the end-user is reviewed by Telligent Community to see if it implements
ILoggableException. If it does, the exception is added to the platform's exception log.
ILoggableException requires only a single member to be implemented:
Category. The string returned by
Category is used within the exception log UI to categorize and filter the list of exceptions in the log.
Sometimes its useful for background processes to log process details not related to exceptions. In this case, plugins can use the Eventlogs API. The event logs API enables plugins to write logging data to the Telligent Community event log (available in Administration > Monitoring > Events). To write an event log entry, use the