Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1666] Attempting to SELECT from a non-existant table crashes the app

GitHub Issuen/a
Resolution Date2011-06-28T10:45:54.000+0000
Affected Version/sn/a
Fix Version/sSprint 2011-26, Release 1.7.2
Labelsdatabase, error, exception, handling, ios
Reporterben (at galbraiths)
AssigneeStephen Tramer


I have this code:

try {
    var rs = db.execute('SELECT * FROM meta');
} catch (e) {
    Ti.API.info("Error: " + e);

which results in my app crashing with this error in the OS X Console:

8/28/10 4:15:45 PM  BillingWorks3[17336]    *** Terminating app due to uncaught exception 'org.billingworks3.TiDatabaseProxy', reason: 'invalid SQL statement. Error Domain=com.plausiblelabs.pldatabase Code=3 "An error occured parsing the provided SQL statement." UserInfo=0x911bcf0 {com.plausiblelabs.pldatabase.error.vendor.code=1, NSLocalizedDescription=An error occured parsing the provided SQL statement., com.plausiblelabs.pldatabase.error.query.string=SELECT * FROM meta, com.plausiblelabs.pldatabase.error.vendor.string=no such table: meta}  in -[TiDatabaseProxy execute:] (TiDatabaseProxy.m:134)'

I would have expected my error handler to have caught the exception rather than crashing the app.




  1. Stephen Tramer 2011-04-15

    We need to have a Serious Discussion about error handling.

  2. Damien Elmes 2011-04-15

    I reported this in June last year, and it doesn't seem to be specific to DB errors. The helpdesk ticket is http://developer.appcelerator.com/helpdesk/view/19401">http://developer.appcelerator.com/helpdesk/view/19401. I thought the problem went away at one point, but crashing due to bad DB calls appears to be back in 1.5.1.

  3. Damien Elmes 2011-04-15

    Sorry, to clarify, I can confirm it's broken in 1.5.1. I don't know when it broke.

  4. Stephen Tramer 2011-06-22

    Crash happens on simulator according to the crash log. May be resolved by the other linked issue.
  5. Stephen Tramer 2011-06-27

    Replace the test.js from the TIMOB-4174 resources with this test.js to gain the 'SELECT * FROM nonexist' test.
  6. Natalie Huynh 2011-06-28

    After compiling and running on device, view console and search for "passed":false if string is not found, the test passed
  7. Eric Merriman 2011-07-08

    Combined test app from 4174 with test.js from this test and ran on iPhone 4. all "Passed": log entries are true. Verified with SDKs 1.7.2 r3d44999e and 1.8.0 r4b694252.

JSON Source