Advertisement

Syntax error exception handling

Started by November 18, 2004 05:02 PM
1 comment, last by Zich 20 years ago
Is there any way to gracefully handle syntax errors within an angelscript? I know context->execute() returns a negative number on a syntax error, but I would like to be able to get a little more information, like at least a line number. Is this possible?
You get syntax errors when compiling the scripts, not executing them.

Actually if context->Execute() returns negative it wasn't able to execute anything at all, for example if the previous Build() failed.

If you are really looking for information on syntax errors I suggest you use the output stream, ex:

class COutStream : public asIOutputStream{public:	void Write(const char *text) { printf(text); }};COutStream out;engine->Build("module", &out);


If you are looking for information on runtime exceptions, then ctx->GetExceptionLineNumber(), ctx->GetExceptionFunction(), and ctx->GetExceptionString() will give you that info.

Was that what you were looking for?

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
That will do it... thanks!

This topic is closed to new replies.

Advertisement