Exceptions and Localization

LangException class

Extension for PHP standard Exception with an extra LangText parameter, typical use case sending messages to users too.

This documentation refers to SuiteCRM version 7.10.3 onwards


try {

  // throw new LangException with located exception message:
  throw new LangException(
    'Exception message for developers', EXCEPTION_CODE, null,

} catch (LangException $e) {

  // using logger to inform the developer about the exception
  $log = LoggerManager::getLogger();
  $log->fatal('Exception happend in the example: ' . $e->getMessage() . ', code: ' . $e->getCode());

  // using SugarApplication to inform the user about the problem with translated message:

Content is available under GNU Free Documentation License 1.3 or later unless otherwise noted.