Exception Error Number 2

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.

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

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

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

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

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

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 :slight_smile: