Crash reporter

In order to solve an issue with TiShadow, David wrote the cross-platform TiLogCatcher module that catches all Titanium exceptions and lets you tap into them using an event listener on the module. He hopes to add full device logs some time soon.

Reporter module

Having access to exceptions in Titanium allowed me to make a CommonJS reporter module that asks testers (ad-hoc builds) or even live users (store builds) to email me the exception, including all relevant app and platform information read from Ti.App and Ti.Platform and a screenshot.

Advantages over TestFlight etc

Crash reports via TestFlight and other services are nice, but they often don’t give you all the information this script collects for you:

  • The JavaScript/Native error just like you’d get them in the console, including backtrace, file, line and message.
  • All relevant Ti.App properties.
  • All relevant Ti.Platform properties.
  • All relevant Ti.Platform.displayCaps properties.
  • A screenshot taken when the error occured.

Why via email?

Of course the script could also send all this information to a server without prompting the user, but in my experience asking the tester for the exact steps for me to reproduce the error helps me a lot to find and resolve the bug.

Example screencast

Screencast

How to use reporter?

  1. Install the yy.logcatcher module.
  2. Drop reporter.js in your Resources or app/lib folder.
  3. Add require('reporter'); to your Resources/app.js or app/alloy.js file.

You might want to use reporter only when you distribute ad-hoc or to a store:

if (Ti.Platform.deployType === 'production') {
  require('reporter');
}

For more options, check the reporter README.

App imagineer: Imagining, Engineering & Speaking about Native mobile Apps with Appcelerator Titanium & Alloy • Meetup organizer • Certified Expert • Titan


Comments