Skip to content

Commit

Permalink
fix: corrected nasty stacktrace error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanneff committed Apr 26, 2018
1 parent 3ed7caf commit 5752f87
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ function executeCallback(method, callback, params) {
);
}

function executeRejection(message) {
function executeReject(message) {
return new Promise(function promise(resolve, reject) {
reject(new Error(message));
reject(message);
});
}

Expand All @@ -62,7 +62,7 @@ Branch.prototype.disableTracking = function disableTracking(isEnabled) {
Branch.prototype.initSession = function initSession(deepLinkDataListener) {
// handle double init from onResume on iOS
if (!runOnce) {
return executeRejection("");
return executeReject("");
}
runOnce = deviceVendor.indexOf("Apple") < 0;

Expand Down Expand Up @@ -131,10 +131,10 @@ Branch.prototype.setMixpanelToken = function setMixpanelToken(token) {

Branch.prototype.setRequestMetadata = function setRequestMetadata(key, val) {
if (!key || typeof key !== "string") {
return executeRejection("Please set key");
return executeReject("Please set key");
}
if (!val || typeof val !== "string") {
return executeRejection("Please set value");
return executeReject("Please set value");
}
return execute("setRequestMetadata", [key, val]);
};
Expand Down Expand Up @@ -166,7 +166,7 @@ Branch.prototype.setIdentity = function setIdentity(identity) {
if (identity) {
return execute("setIdentity", [String(identity)]);
}
return executeRejection("Please set an identity");
return executeReject("Please set an identity");
};

Branch.prototype.logout = function logout() {
Expand All @@ -179,7 +179,7 @@ Branch.prototype.userCompletedAction = function userCompletedAction(
) {
var args = [action];
if (!action) {
return executeRejection("Please set an event name");
return executeReject("Please set an event name");
}

if (metaData) {
Expand All @@ -195,7 +195,7 @@ Branch.prototype.sendCommerceEvent = function sendCommerceEvent(
) {
var args = [action];
if (!action) {
return executeRejection("Please set a commerce event");
return executeReject("Please set a commerce event");
}

if (metaData) {
Expand Down Expand Up @@ -274,7 +274,7 @@ Branch.prototype.createBranchUniversalObject = function createBranchUniversalObj
if (!(deviceVendor.indexOf("Apple") < 0)) {
return execute("listOnSpotlight", [obj.instanceId]);
}
return reject(new Error("iOS Spotlight only"));
return executeReject("iOS Spotlight only");
};

resolve(obj);
Expand Down

0 comments on commit 5752f87

Please sign in to comment.