Exceptions

In my device code I'm calling the telnet connect method which generates an error if the connection to the telnet server cannot be made.

I can use try/catch in the device code and it works as expected.

But, instead, if I put the try/catch in the app, which invokes the device method, which invokes the telnet connect method, the error appears in the log but the exception doesn't seem to "percolate" back up to the app.

Is this normal?

Thanks, Frederick

I moved this to the Developers/Coding Questions as it seems to fit there better.

2 Likes

Correct, as the App and Device/Driver have separate execution contexts, the typical expectation of being able to catch an exception at a higher layer does not work here.

Best option for such a case would be to put the try/catch in the driver, and in the catch clause, you can return a specific value to indicate the error, or even the exception message itself.

2 Likes

Thanks.

I just wanted to verify that what I suspected, based on what I saw, was true.

Frederick

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.