Skip to content

Commit

Permalink
Fix spelling errors in error messages. Replace outdated reference to …
Browse files Browse the repository at this point in the history
…emitter.addExperimentVariant in error message. #5
  • Loading branch information
wehriam committed Feb 5, 2016
1 parent 9b491a4 commit c888953
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions lib/emitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ PushtellEventEmitter.prototype.addExperimentVariant = function (experimentName,
experimentWeights[experimentName] = experimentWeights[experimentName] || {};
if (experiments[experimentName][variantName] !== true) {
if (experimentsWithDefinedVariants[experimentName]) {
var error = new Error("Expiriment “" + experimentName + "” added new variants after variants were defined.");
var error = new Error("Experiment “" + experimentName + "” added new variants after variants were defined.");
error.type = "PUSHTELL_INVALID_VARIANT";
throw error;
}
if (values[experimentName]) {
var error = new Error("Expiriment “" + experimentName + "” added new variants after a variant was selected. Declare the variant names using emitter.addExpirimentVariants(expirimentName, variantNames).");
var error = new Error("Experiment “" + experimentName + "” added new variants after a variant was selected. Declare the variant names using emitter.defineVariants(experimentName, variantNames).");
error.type = "PUSHTELL_INVALID_VARIANT";
throw error;
}
Expand Down
4 changes: 2 additions & 2 deletions src/emitter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ PushtellEventEmitter.prototype.addExperimentVariant = function(experimentName, v
experimentWeights[experimentName] = experimentWeights[experimentName] || {};
if(experiments[experimentName][variantName] !== true) {
if(experimentsWithDefinedVariants[experimentName]) {
const error = new Error("Expiriment “" + experimentName + "” added new variants after variants were defined.");
const error = new Error("Experiment “" + experimentName + "” added new variants after variants were defined.");
error.type = "PUSHTELL_INVALID_VARIANT";
throw error;
}
if(values[experimentName]) {
const error = new Error("Expiriment “" + experimentName + "” added new variants after a variant was selected. Declare the variant names using emitter.addExpirimentVariants(expirimentName, variantNames).");
const error = new Error("Experiment “" + experimentName + "” added new variants after a variant was selected. Declare the variant names using emitter.defineVariants(experimentName, variantNames).");
error.type = "PUSHTELL_INVALID_VARIANT";
throw error;
}
Expand Down
24 changes: 12 additions & 12 deletions standalone.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule warning
*/

'use strict';
Expand Down Expand Up @@ -447,7 +446,6 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule emptyFunction
*/

"use strict";
Expand Down Expand Up @@ -674,12 +672,12 @@
experimentWeights[experimentName] = experimentWeights[experimentName] || {};
if (experiments[experimentName][variantName] !== true) {
if (experimentsWithDefinedVariants[experimentName]) {
var error = new Error("Expiriment “" + experimentName + "” added new variants after variants were defined.");
var error = new Error("Experiment “" + experimentName + "” added new variants after variants were defined.");
error.type = "PUSHTELL_INVALID_VARIANT";
throw error;
}
if (values[experimentName]) {
var error = new Error("Expiriment “" + experimentName + "” added new variants after a variant was selected. Declare the variant names using emitter.addExpirimentVariants(expirimentName, variantNames).");
var error = new Error("Experiment “" + experimentName + "” added new variants after a variant was selected. Declare the variant names using emitter.defineVariants(experimentName, variantNames).");
error.type = "PUSHTELL_INVALID_VARIANT";
throw error;
}
Expand Down Expand Up @@ -973,7 +971,7 @@
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
* @providesModule EventSubscription
* @typechecks
*/
Expand Down Expand Up @@ -1005,7 +1003,10 @@
*/

EventSubscription.prototype.remove = function remove() {
this.subscriber.removeSubscription(this);
if (this.subscriber) {
this.subscriber.removeSubscription(this);
this.subscriber = null;
}
};

return EventSubscription;
Expand Down Expand Up @@ -1137,7 +1138,7 @@
* @providesModule invariant
*/

"use strict";
'use strict';

/**
* Use invariant() to assert state which your program assumes to be true.
Expand All @@ -1150,7 +1151,7 @@
* will remain to ensure logic does not differ in production.
*/

var invariant = function (condition, format, a, b, c, d, e, f) {
function invariant(condition, format, a, b, c, d, e, f) {
if (process.env.NODE_ENV !== 'production') {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
Expand All @@ -1164,15 +1165,16 @@
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error('Invariant Violation: ' + format.replace(/%s/g, function () {
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}

error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
};
}

module.exports = invariant;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
Expand Down Expand Up @@ -1276,7 +1278,6 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule crc32
*
*/

Expand Down Expand Up @@ -1548,7 +1549,6 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ExecutionEnvironment
*/

'use strict';
Expand Down
16 changes: 8 additions & 8 deletions test/browser/emitter.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ describe("Emitter", function() {
};
let experimentNameGlobal = null;
let playedVariantNameGlobal = null;
let playCallbackGlobal = function(expirimentName, variantName){
experimentNameGlobal = expirimentName;
let playCallbackGlobal = function(experimentName, variantName){
experimentNameGlobal = experimentName;
playedVariantNameGlobal = variantName;
};
let playSubscription = emitter.addPlayListener(experimentName, playCallback);
Expand Down Expand Up @@ -64,8 +64,8 @@ describe("Emitter", function() {
};
let experimentNameGlobal = null;
let winningVariantNameGlobal = null;
let winCallbackGlobal = function(expirimentName, variantName){
experimentNameGlobal = expirimentName;
let winCallbackGlobal = function(experimentName, variantName){
experimentNameGlobal = experimentName;
winningVariantNameGlobal = variantName;
};
let winSubscription = emitter.addWinListener(experimentName, winCallback);
Expand Down Expand Up @@ -97,8 +97,8 @@ describe("Emitter", function() {
};
let experimentNameGlobal = null;
let winningVariantNameGlobal = null;
let winCallbackGlobal = function(expirimentName, variantName){
experimentNameGlobal = expirimentName;
let winCallbackGlobal = function(experimentName, variantName){
experimentNameGlobal = experimentName;
winningVariantNameGlobal = variantName;
};
let winSubscription = emitter.addWinListener(experimentName, winCallback);
Expand Down Expand Up @@ -134,8 +134,8 @@ describe("Emitter", function() {
};
let experimentNameGlobal = null;
let activeVariantNameGlobal = null;
let activeVariantCallbackGlobal = function(expirimentName, variantName){
experimentNameGlobal = expirimentName;
let activeVariantCallbackGlobal = function(experimentName, variantName){
experimentNameGlobal = experimentName;
activeVariantNameGlobal = variantName;
};
let activeVariantSubscription = emitter.addActiveVariantListener(experimentName, activeVariantCallback);
Expand Down
4 changes: 2 additions & 2 deletions test/browser/experiment.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ describe("Experiment", function() {
};
let experimentNameGlobal = null;
let winningVariantNameGlobal = null;
let winCallbackGlobal = function(expirimentName, variantName){
experimentNameGlobal = expirimentName;
let winCallbackGlobal = function(experimentName, variantName){
experimentNameGlobal = experimentName;
winningVariantNameGlobal = variantName;
};
let winSubscription = emitter.addWinListener(experimentName, winCallback);
Expand Down

0 comments on commit c888953

Please sign in to comment.