Error CodeGen::setError(Error error, const char* message) { if (error == kErrorOk) { _error = kErrorOk; return kErrorOk; } if (message == NULL) { #if !defined(ASMJIT_DISABLE_NAMES) message = ErrorUtil::asString(error); #else static const char noMessage[] = ""; message = noMessage; #endif // ASMJIT_DISABLE_NAMES } // Error handler is called before logger so logging can be skipped if error // has been handled. ErrorHandler* handler = _errorHandler; ASMJIT_TLOG("[ERROR] %s %s\n", message, !handler ? "(Possibly unhandled?)" : ""); if (handler != NULL && handler->handleError(error, message)) return error; #if !defined(ASMJIT_DISABLE_LOGGER) Logger* logger = _logger; if (logger != NULL) { logger->logFormat(kLoggerStyleComment, "*** ERROR: %s (%u).\n", message, static_cast<unsigned int>(error)); } #endif // !ASMJIT_DISABLE_LOGGER // The handler->handleError() function may throw an exception or longjmp() // to terminate the execution of setError(). This is the reason why we have // delayed changing the _error member until now. _error = error; return error; }