Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3053] "Ti.include" throws uncatchable exception when file don't exist

GitHub Issuen/a
ResolutionWon't Fix
Resolution Date2011-07-09T04:55:17.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
ReporterIvan Skugor
AssigneeTony Guntharp


Hi. "Ti.include" throws uncatchable exception when trying to include file that don't exists. Following code demonstrates the issue:
try {
catch(e) {
This code throws "java.io.FileNotFoundException" that can't be caught. Q/A: http://developer.appcelerator.com/question/121769/catch-tiinclude-file-not-found-exception


  1. Paul Dowsett 2011-07-09

    Ivan, what you are asking does not make sense at all. You should not ship an app that has missing files. Hence, an exception is the best way of preventing this. Please let me know if I have overlooked a reasonable situation where it should indeed be done. Thanks
  2. Paul Dowsett 2011-07-09

    btw, including the SDK build date and hash is required when submitting tickets. Please refer to [Jira Ticket Checklist](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-Summary%3AJiraTicketChecklist). Thanks
  3. Ivan Skugor 2011-07-11

    Hi Paul. I've updated ticket with SDK build date and hash. As for your comment, I agree with you. But, in dynamic scenarios (and with respect on variety of mobile and tablet application purposes and implementations) you can't predict and test any possible situation and exceptions are possible (including exceptions generated by "Ti.include"). What I would like to have is ability to control situations when exception is thrown (log errors for example, recover from exception, etc.). This particular exception can be avoided using "file.exists()", but IMHO, using try-catch block is semantically correct approach. You can leave this as it is now, but then at least update documentation with explanation that "Ti.include" throws uncatchable exception if file is not found. Thanks.

JSON Source