Complete
over 4 years ago

WERETECH-6805

This was addressed in CIQ 3.1.1.

How to debug an unhandled exception

On a fresh Eclipse install on macOS High Sierra with recommended settings (several example apps do build and run), I can't seem to get a strack trace after an unhandled exception (aka app crash). Without that information, it's pretty much impossible to debug an app, so I guess I just missed some setting.

What did I miss?
Former Member
Former Member
Parents
  • ekutter, agreed on all points. But TL;DR handling exceptions doesn't necessarily mean you expect to have bugs in your code. --- But, depending on your available memory for code, exceptions can be expected, assuming you wrote your code that way. Errors can be expected too: e.g. invalid user input (obviously this is very rare in the context of CIQ, but I have a data field where it's very relevant) or lack of resources. There are some styles of coding where exceptions are used for just about every kind of error. However, in a resource-constrained CIQ data field, I would prefer to use different ways of reporting errors internally, as exceptions have a bit of code overhead, especially just the code for creating a custom exception class. I saved a lot of code in one data field by using a global error variable :( instead of an exception that could be thrown from anywhere. (This is the same field that can take invalid user input.) Anyway, like it or not, there are some cases in CIQ where exceptions can happen and they are not the result of user error or application bugs. e.g. Toybox::Ant::UnableToAcquireChannelException Thrown if the GenericChannel.initialize() is unable to acquire an ANT channel from the system. This indicates that all available ANT channels are in use. So if you're using an ANT generic channel, you have no choice but to handle exceptions in at least one place, unless you just want your app to crash in that case.
Comment
  • ekutter, agreed on all points. But TL;DR handling exceptions doesn't necessarily mean you expect to have bugs in your code. --- But, depending on your available memory for code, exceptions can be expected, assuming you wrote your code that way. Errors can be expected too: e.g. invalid user input (obviously this is very rare in the context of CIQ, but I have a data field where it's very relevant) or lack of resources. There are some styles of coding where exceptions are used for just about every kind of error. However, in a resource-constrained CIQ data field, I would prefer to use different ways of reporting errors internally, as exceptions have a bit of code overhead, especially just the code for creating a custom exception class. I saved a lot of code in one data field by using a global error variable :( instead of an exception that could be thrown from anywhere. (This is the same field that can take invalid user input.) Anyway, like it or not, there are some cases in CIQ where exceptions can happen and they are not the result of user error or application bugs. e.g. Toybox::Ant::UnableToAcquireChannelException Thrown if the GenericChannel.initialize() is unable to acquire an ANT channel from the system. This indicates that all available ANT channels are in use. So if you're using an ANT generic channel, you have no choice but to handle exceptions in at least one place, unless you just want your app to crash in that case.
Children
No Data