Exception Error Number 2

  1. 6 months ago

    Hi I am getting a runtime exception exception message which reads the following:

    An exception of class RuntimeException Was not handled The application must shutdown
    Exception Error Number: 2.

    I then press okay and the error goes away, but the program does not crash, it continues to run the way it is supposed to.

    I believe the error is occurring at this point of my code.

    It is in the 'Complete' Event Handler of my Shell object.

    The shell is in mode 1 (Asynchronous) and runs a Shell script which downloads a file.

    In the "complete" event my code looks as follows:

    try
      try
        mainPogram.Execute("/home/pi/Machine\ Controller/Machine\ Controller")
      catch e As RuntimeException
        MsgBox("Run exception")
      end try
    catch e As NilObjectException
      MsgBox("NILObjet exception")
    end try
    

    The 'mainProgram' is another Shell object which is also in Asynchronous mode.

    ^^None of the message boxes in the catch blocks ever appear.

    Any ideas why this error is occurring but not killing my program, can I just suppress the error?

    Am I handling it in the wrong way?

    What does error number 2 represent.

  2. Tim H

    12 Mar 2018 Pre-Release Testers Portland, OR USA

    Are you trying to display a msgbox from a program running in a shell? I don't think that works.

  3. no, the program is a GUI, it just has a shell object inside it which can write commands.

  4. Tim H

    12 Mar 2018 Pre-Release Testers Portland, OR USA
    Edited 6 months ago

    No clue what's going wrong, but I want to point out that you can have multiple Catch statements in a single Try.

    try
        mainPogram.Execute("/home/pi/Machine\ Controller/Machine\ Controller")
    catch e As RuntimeException
        MsgBox("Run exception")
    catch e As NilObjectException
        MsgBox("NILObjet exception")
    end try
  5. Tim H

    12 Mar 2018 Pre-Release Testers Portland, OR USA

    If you run it in the debugger, where does the IDE stop?

  6. Tim H

    12 Mar 2018 Pre-Release Testers Portland, OR USA

    Alternately, put code in the app.UnhandledException event to print out the contents of error.stack

  7. Thanks for your help, I changed the try catch statement

    Still getting the error,

    UPDATE: I solved it!

    In my shell script within the Asyc shell, I was running an executable, I think this is why the error was generated because the shell would never reach the 'Completed' event (until the exe was closed).

    Still puzzled as to why it diddn't crash though.

    Thanks for your help :)

or Sign Up to reply!