Squirrel

The programming language
Welcome to Squirrel Sign in | Join | Help
in Search

passing the same exception upwards

Last post 06-23-2009, 6:11 PM by atai. 0 replies.
Sort Posts: Previous Next
  •  06-23-2009, 6:11 PM 3326

    passing the same exception upwards

    Hi, how can I pass an exception "upwards"?

    that is, if I have

    try
    {
    /* some code */
    }

    catch (id)
    {

        if (id == "something I throw")
        {
            /* I handle it */
        }
        else /* not my exception; I do not want to handle it but pass it outwards */
            throw(id);
    }

    if I use the code as above, and I have a Squirrel error in the "some code" (like non-existent array index), the eventual error message from Squirrel would not be shown correctly (the line number would refer to the point of the second "throw", not the location of the real error).

    Or there are other ways to control what exception is caught in the "catch  () { }" code?

    Thanks
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems