Hi friends,
in my plugin, there's a class that throws Exceptions (with "throw new Exception('Desc');"). How do I ensure to display this Exceptions like the APPLICATTION ERROR #XXX Mantis throws itself?
Thanks!
Kind regards,
dandjo
Plugin Development 1.2.3: throwing formatted Exceptions
Moderators: Developer, Contributor
Re: Plugin Development 1.2.3: throwing formatted Exceptions
Look source about string trigger_error(
message for error can be stored in lang files of your plugins
message for error can be stored in lang files of your plugins
Re: Plugin Development 1.2.3: throwing formatted Exceptions
Hm, trigger_error() just lets me define a code and a localized text, i wanted to print the exception and the stacktrace.
I also didn't get how to use $MANTIS_ERROR[XXX] = 'localized text' in plugindir/lang/strings_english.txt to display with trigger_errur(XXX, ERROR). Pleas help!
I also didn't get how to use $MANTIS_ERROR[XXX] = 'localized text' in plugindir/lang/strings_english.txt to display with trigger_errur(XXX, ERROR). Pleas help!
Re: Plugin Development 1.2.3: throwing formatted Exceptions
pluginname/pluginname.php
pluginname/lang/strings_english.php
Code: Select all
if ($error) {
error_parameters( plugin_lang_get( 'my_error' ) );
trigger_error( ERROR_PLUGIN_GENERIC, ERROR );
} Code: Select all
$s_plugin_pluginname_error_my_error = 'This text of my errors';
Re: Plugin Development 1.2.3: throwing formatted Exceptions
Thanks, I found a smarter way
Code: Select all
if ($error) {
plugin_error(plugin_lang_get('my_error'), ERROR);
}