Catch Runtime Errors

After developing two games using corona and many learned lessons, I still have a lack of understanding of Corona’s error handling. I’m working on a business type app (not as fun as making games) and I come across runtime errors that crash the app. I have had a hard time catching those errors, in fact the only method that I know to catch an error is the user-unfriendly pcall(methodName, “error string”).

I’m a C# .net developer and I love the try catch blocks, exception hierarchy as well as bubbling up error messages. Now I realize there are big differences between Lua and C# but is there somewhere I can meet in the middle? I have defensive code in my functions to try to prevent the errors but unless I’m running the simulator, I have no idea what my runtime errors are on my device. There are no error logs on the device (when viewed in xCode organizer).

Is there a way that I can “catch” all runtime errors and access the actual message at the beginning of my app and display them either to the app screen (beta) and eventually a device error log? The errors that appear in the simulator when a runtime error occurs would be fine. If not, what other error handling techniques have you found useful?

I have also found that runtime errors that occur on my device do not happen on the simulator, which is quite annoying.

I’d love to do something like this:

try
{
StartApp()
}
catch(Exception ex)
{
HandleException(ex) – either displays to screen or records to an error log
}

Thanks,
Rob [import]uid: 38348 topic_id: 31674 reply_id: 331674[/import]

Xcode should show errors - what iOS is your test device? [import]uid: 52491 topic_id: 31674 reply_id: 126615[/import]

well, we are working on the IOS 5 and IOS 6 for our initial development and then plan to work on Android. We currently have an iPhone 4 running IOS 5, and iPhone 4 running IOS6, and iPhone 5, and iPad 2 and an iPad 3. We have access to an iPhone 3 but the latest version of xcode doesn’t seem to support that device.

in xCode will the runtime errors show up in Organizer? That’s all I use xCode for at the moment as I develop on a Win 7 machine.

thanks [import]uid: 38348 topic_id: 31674 reply_id: 126617[/import]

You will get print errors in the console log under each device in the Xcode organizer, yes - though if you don’t on iOS 6 please refer to Tom’s blog post from last week as it covers how to solve this.

Peach :slight_smile: [import]uid: 52491 topic_id: 31674 reply_id: 126809[/import]

Xcode should show errors - what iOS is your test device? [import]uid: 52491 topic_id: 31674 reply_id: 126615[/import]

well, we are working on the IOS 5 and IOS 6 for our initial development and then plan to work on Android. We currently have an iPhone 4 running IOS 5, and iPhone 4 running IOS6, and iPhone 5, and iPad 2 and an iPad 3. We have access to an iPhone 3 but the latest version of xcode doesn’t seem to support that device.

in xCode will the runtime errors show up in Organizer? That’s all I use xCode for at the moment as I develop on a Win 7 machine.

thanks [import]uid: 38348 topic_id: 31674 reply_id: 126617[/import]

You will get print errors in the console log under each device in the Xcode organizer, yes - though if you don’t on iOS 6 please refer to Tom’s blog post from last week as it covers how to solve this.

Peach :slight_smile: [import]uid: 52491 topic_id: 31674 reply_id: 126809[/import]

it looks like it just says to upgrade to the daily build > 925. I experienced these errors with 928.

I finally found one of the bugs that was causing my problems. However, the need remains for better working error handling and reporting.

thanks [import]uid: 38348 topic_id: 31674 reply_id: 127244[/import]

it looks like it just says to upgrade to the daily build > 925. I experienced these errors with 928.

I finally found one of the bugs that was causing my problems. However, the need remains for better working error handling and reporting.

thanks [import]uid: 38348 topic_id: 31674 reply_id: 127244[/import]