Skip to content

Commit

Permalink
style: standardized error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanneff committed Mar 2, 2017
1 parent f21736b commit fb9b864
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion hooks/afterPrepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
iosPlist.addBranchSettings(preferences)
iosCapabilities.enableAssociatedDomains(preferences)
iosAssociatedDomains.addAssociatedDomains(preferences)
iosDevelopmentTeam.addDevelopmentTeam(preferences) // does not work, still needs to run through Xcode
iosDevelopmentTeam.addDevelopmentTeam(preferences)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion hooks/lib/android/androidManifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
} else if (preferences.linkDomain.indexOf('bnc.lt') !== -1) {
// bnc.lt
if (preferences.androidPrefix == null) {
throw new Error('Branch SDK plugin is missing "android-prefix" in <branch-config> in your config.xml')
throw new Error('BRANCH SDK: Missing "android-prefix" in <branch-config> in your config.xml. https://goo.gl/GijGKP')
}

intentFilterData.push(getAppLinkIntentFilterDictionary(preferences.linkDomain, preferences.androidPrefix))
Expand Down
4 changes: 2 additions & 2 deletions hooks/lib/ios/developmentTeam.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
// pretty-json
return JSON.stringify(content, null, 2)
} catch (err) {
throw new Error('Branch SDK cannot write build.json within your root directory.')
throw new Error('BRANCH SDK: Cannot write build.json within your root directory. https://goo.gl/GijGKP')
}
}

Expand All @@ -44,7 +44,7 @@
try {
return JSON.parse(content)
} catch (err) {
throw new Error('Branch SDK cannot read build.json within your root directory.')
throw new Error('BRANCH SDK: Cannot read build.json within your root directory. https://goo.gl/GijGKP')
}
}

Expand Down
4 changes: 2 additions & 2 deletions hooks/lib/npm/nodeDependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
installNodeModules(modules, function (err) {
if (err) {
// handle error
throw new Error('BRANCH SDK: Failed to install the Branch SDK')
throw new Error('BRANCH SDK: Failed to install the Branch SDK. https://goo.gl/GijGKP')
} else {
// only run once
setPackageInstalled(installFlagLocation)
Expand Down Expand Up @@ -59,7 +59,7 @@
// handle error
if (err) {
callback(true)
throw new Error('BRANCH SDK: Failed to install Branch Dependency: "' + module + '"')
throw new Error('BRANCH SDK: Failed to install Branch node dependency ' + module + '. https://goo.gl/GijGKP')
} else {
// next module
installNodeModules(modules, callback)
Expand Down
16 changes: 8 additions & 8 deletions hooks/lib/sdk/configXml.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
var configXml = xmlHelper.readXmlAsJson(pathToConfigXml)

if (configXml == null) {
throw new Error('config.xml not found! Please, check that it exist in your project\'s root directory.')
throw new Error('BRANCH SDK: A config.xml is not found in project\'s root directory. https://goo.gl/GijGKP')
}

return configXml
Expand All @@ -38,7 +38,7 @@
var branchConfig = configXml.widget['branch-config']

if (branchConfig == null || branchConfig.length === 0) {
throw new Error('<branch-config> tag is not set in the config.xml. The Branch SDK is not properly installed.')
throw new Error('BRANCH SDK: <branch-config> tag is not set in the config.xml. https://goo.gl/GijGKP')
}

return branchConfig[0]
Expand Down Expand Up @@ -89,22 +89,22 @@
// validate <branch-config> properties within config.xml
function validateBranchPreferences (preferences) {
if (preferences.bundleId === null) {
throw new Error('Branch SDK plugin is missing "widget id" in your config.xml')
throw new Error('BRANCH SDK: Missing "widget id" in your config.xml. https://goo.gl/GijGKP')
}
if (preferences.bundleName === null) {
throw new Error('Branch SDK plugin is missing "name" in your config.xml')
throw new Error('BRANCH SDK: Missing "name" in your config.xml. https://goo.gl/GijGKP')
}
if (preferences.branchKey === null) {
throw new Error('Branch SDK plugin is missing "branch-key" in <branch-config> in your config.xml')
throw new Error('BRANCH SDK: Missing "branch-key" in <branch-config> in your config.xml. https://goo.gl/GijGKP')
}
if (preferences.uriScheme === null) {
throw new Error('Branch SDK plugin is missing "uri-scheme" in <branch-config> in your config.xml')
throw new Error('BRANCH SDK: Missing "uri-scheme" in <branch-config> in your config.xml. https://goo.gl/GijGKP')
}
if (preferences.linkDomain === null) {
throw new Error('Branch SDK plugin is missing "uri-scheme" in <branch-config> in your config.xml')
throw new Error('BRANCH SDK: Missing "uri-scheme" in <branch-config> in your config.xml. https://goo.gl/GijGKP')
}
if (preferences.iosTeamProd === null) {
throw new Error('Branch SDK plugin is missing "ios-team-prod" in <branch-config> in your config.xml')
throw new Error('BRANCH SDK: Missing "ios-team-prod" in <branch-config> in your config.xml. https://goo.gl/GijGKP')
}
}
})()

0 comments on commit fb9b864

Please sign in to comment.