Repository: cordova-android Updated Branches: refs/heads/master 2532c4a39 -> b2d712442
CB-11999 add message, catch exception if require fails Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/b2d71244 Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/b2d71244 Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/b2d71244 Branch: refs/heads/master Commit: b2d7124424340b3c6534c0701bd10f9697be3433 Parents: 2532c4a Author: Jesse MacFadyen <purplecabb...@gmail.com> Authored: Tue Oct 11 17:19:10 2016 -0700 Committer: Jesse MacFadyen <purplecabb...@gmail.com> Committed: Wed Oct 12 11:48:06 2016 -0700 ---------------------------------------------------------------------- bin/templates/cordova/Api.js | 42 ++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-android/blob/b2d71244/bin/templates/cordova/Api.js ---------------------------------------------------------------------- diff --git a/bin/templates/cordova/Api.js b/bin/templates/cordova/Api.js index bec578c..28a0ab5 100644 --- a/bin/templates/cordova/Api.js +++ b/bin/templates/cordova/Api.js @@ -109,13 +109,20 @@ function Api(platform, platformRootDir, events) { */ Api.createPlatform = function (destination, config, options, events) { events = setupEvents(events); - - return require('../../lib/create') - .create(destination, config, options, events) - .then(function (destination) { - var PlatformApi = require(path.resolve(destination, 'cordova/Api')); - return new PlatformApi(PLATFORM, destination, events); - }); + var result; + try { + result = require('../../lib/create') + .create(destination, config, options, events) + .then(function (destination) { + var PlatformApi = require(path.resolve(destination, 'cordova/Api')); + return new PlatformApi(PLATFORM, destination, events); + }); + } + catch (e) { + events.emit('error','createPlatform is not callable from the android project API.'); + throw(e); + } + return result; }; /** @@ -136,13 +143,20 @@ Api.createPlatform = function (destination, config, options, events) { */ Api.updatePlatform = function (destination, options, events) { events = setupEvents(events); - - return require('../../lib/create') - .update(destination, options, events) - .then(function (destination) { - var PlatformApi = require(path.resolve(destination, 'cordova/Api')); - return new PlatformApi('android', destination, events); - }); + var result; + try { + result = require('../../lib/create') + .update(destination, options, events) + .then(function (destination) { + var PlatformApi = require(path.resolve(destination, 'cordova/Api')); + return new PlatformApi('android', destination, events); + }); + } + catch (e) { + events.emit('error','updatePlatform is not callable from the android project API, you will need to do this manually.'); + throw(e); + } + return result; }; /** --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org