类 | |
| struct | ScriptErrorContext |
| Structured snapshot of a script error: message, throw site and stack. 更多... | |
| struct | ScriptFrame |
| One call-stack frame captured while the script error is still live. 更多... | |
函数 | |
| ScriptErrorContext | captureScriptError (HSQUIRRELVM vm) |
| Captures the pending runtime error from inside the Squirrel error handler. | |
| ScriptErrorContext | captureCompileError (HSQUIRRELVM vm) |
| Captures the last compilation error recorded by the VM. | |
| bool | parseCompileError (const std::string &text, std::string *source, int *line, int *column, std::string *message) |
| Parses the ssq compile message "Compile error at source:line:column msg". | |
| std::string | sourceLineText (const std::string &sourceText, int line) |
| Extracts one 1-based line from script source text. | |
| std::string | formatStackTrace (const std::vector< ScriptFrame > &frames) |
| Formats just the call-stack portion of a context. | |
| std::string | formatScriptError (const ScriptErrorContext &ctx) |
| Formats a context into a human-readable multi-line report. | |
| void | setLastScriptError (HSQUIRRELVM vm, ScriptErrorContext ctx) |
| Records the last error for a VM (thread-local, synchronous consumers). | |
| ScriptErrorContext | takeLastScriptError (HSQUIRRELVM vm) |
| Consumes and clears the last recorded error for a VM. | |
| const ScriptErrorContext * | peekLastScriptError (HSQUIRRELVM vm) |
| Peeks at the last recorded error for a VM without clearing it. | |
| void | clearLastScriptError (HSQUIRRELVM vm) |
| Drops any recorded error for a VM. | |
函数说明
◆ captureCompileError()
| ScriptErrorContext eve::script::captureCompileError | ( | HSQUIRRELVM | vm | ) |
Captures the last compilation error recorded by the VM.
- 参数
-
vm VM whose compile just failed (ssq's compiler handler stores it).
- 返回
- Context with message, source, line and column.
在文件 ScriptError.cpp 第 103 行定义.
引用了 eve::script::ScriptErrorContext::column, eve::script::ScriptErrorContext::line, eve::script::ScriptErrorContext::message, parseCompileError(), eve::script::ScriptErrorContext::source , 以及 vm.
被这些函数引用 eve::dev::ConsolePanel::eval() , 以及 eve::dev::Debugger::evaluate().
◆ captureScriptError()
| ScriptErrorContext eve::script::captureScriptError | ( | HSQUIRRELVM | vm | ) |
Captures the pending runtime error from inside the Squirrel error handler.
- 参数
-
vm VM whose error handler is executing (error value at stack slot 2).
- 返回
- Context with the message and the still-live call stack.
在文件 ScriptError.cpp 第 80 行定义.
引用了 eve::script::ScriptFrame::function, eve::script::ScriptErrorContext::function, eve::script::ScriptFrame::line, eve::script::ScriptErrorContext::line, eve::script::ScriptErrorContext::message, eve::script::ScriptFrame::source, eve::script::ScriptErrorContext::source, eve::script::ScriptErrorContext::stack , 以及 vm.
◆ clearLastScriptError()
| void eve::script::clearLastScriptError | ( | HSQUIRRELVM | vm | ) |
Drops any recorded error for a VM.
- 参数
-
vm VM whose pending error should be forgotten.
在文件 ScriptError.cpp 第 226 行定义.
引用了 vm.
被这些函数引用 eve::Runtime::shutdown().
◆ formatScriptError()
| std::string eve::script::formatScriptError | ( | const ScriptErrorContext & | ctx | ) |
Formats a context into a human-readable multi-line report.
- 参数
-
ctx Context to format.
- 返回
- "source:line (function): message" plus optional hint and stack.
在文件 ScriptError.cpp 第 189 行定义.
引用了 formatStackTrace(), eve::script::ScriptErrorContext::function, eve::script::ScriptErrorContext::hint, eve::script::ScriptErrorContext::line, eve::script::ScriptErrorContext::message, eve::script::ScriptErrorContext::source , 以及 eve::script::ScriptErrorContext::stack.
被这些函数引用 eve::dev::ConsolePanel::eval(), eve::dev::Debugger::evaluate(), eve::Runtime::execute() , 以及 eve::ScriptException::ScriptException().
◆ formatStackTrace()
| std::string eve::script::formatStackTrace | ( | const std::vector< ScriptFrame > & | frames | ) |
Formats just the call-stack portion of a context.
- 参数
-
frames Frames to render, innermost first.
- 返回
- One "source:line in function" line per frame, newline separated.
在文件 ScriptError.cpp 第 175 行定义.
被这些函数引用 formatScriptError().
◆ parseCompileError()
| bool eve::script::parseCompileError | ( | const std::string & | text, |
| std::string * | source, | ||
| int * | line, | ||
| int * | column, | ||
| std::string * | message | ||
| ) |
Parses the ssq compile message "Compile error at source:line:column msg".
- 参数
-
text Message produced by ssq::CompileException::what(). source Receives the source name (may be nullptr). line Receives the 1-based line (may be nullptr). column Receives the 1-based column (may be nullptr). message Receives the raw compiler description (may be nullptr).
- 返回
- True when the message matched the expected layout.
在文件 ScriptError.cpp 第 120 行定义.
引用了 line.
被这些函数引用 captureCompileError().
◆ peekLastScriptError()
| const ScriptErrorContext * eve::script::peekLastScriptError | ( | HSQUIRRELVM | vm | ) |
Peeks at the last recorded error for a VM without clearing it.
- 参数
-
vm VM the error belongs to.
- 返回
- Pointer to the stored context, or nullptr when none is pending.
在文件 ScriptError.cpp 第 220 行定义.
引用了 vm.
◆ setLastScriptError()
| void eve::script::setLastScriptError | ( | HSQUIRRELVM | vm, |
| ScriptErrorContext | ctx | ||
| ) |
Records the last error for a VM (thread-local, synchronous consumers).
- 参数
-
vm VM the error belongs to. ctx Context to store.
在文件 ScriptError.cpp 第 206 行定义.
引用了 vm.
◆ sourceLineText()
| std::string eve::script::sourceLineText | ( | const std::string & | sourceText, |
| int | line | ||
| ) |
Extracts one 1-based line from script source text.
- 参数
-
sourceText Full script source. line 1-based line number.
- 返回
- The line without trailing newline, or empty when out of range.
在文件 ScriptError.cpp 第 159 行定义.
引用了 line.
◆ takeLastScriptError()
| ScriptErrorContext eve::script::takeLastScriptError | ( | HSQUIRRELVM | vm | ) |
Consumes and clears the last recorded error for a VM.
- 参数
-
vm VM the error belongs to.
- 返回
- The stored context, or an empty context when none is pending.
在文件 ScriptError.cpp 第 211 行定义.
引用了 vm.
被这些函数引用 eve::dev::ConsolePanel::eval(), eve::dev::Debugger::evaluate() , 以及 eve::Runtime::execute().