Sets a custom error or warning message. This function is useful for plugins which wish to generate custom error/warning messages that will be displayed in the calling script. Errors/warnings are set and memorized on a thread-basis (e.g. threads originating from threaded scripts have each an individual error handler). See also sim.getLastError, the sim.intparam_error_report_mode and the error report modes.