Jump to content

  • Log In with Google      Sign In   
  • Create Account

- - - - -

Syntax error exception handling


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Zich   Members   -  Reputation: 122

Like
0Likes
Like

Posted 18 November 2004 - 11:02 AM

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?

Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3446

Like
0Likes
Like

Posted 18 November 2004 - 11:57 AM

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

#3 Zich   Members   -  Reputation: 122

Like
0Likes
Like

Posted 19 November 2004 - 04:05 AM

That will do it... thanks!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS