🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Syntax error exception handling

Started by
1 comment, last by Zich 19 years, 7 months 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?
Advertisement
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

That will do it... thanks!

This topic is closed to new replies.

Advertisement