Permalink
Browse files

Now that checkSuccess/Error are in waiter object, remove extra waiter…

… object reference (use this)
  • Loading branch information...
1 parent da60617 commit 4e8b4ec0a652dc57e2c491146a15f4beb6de2a7d @lsegal lsegal committed Dec 7, 2013
Showing with 11 additions and 11 deletions.
  1. +11 −11 lib/resource_waiter.js
View
@@ -85,7 +85,7 @@ AWS.ResourceWaiter = inherit({
request.removeListener('extractError', AWS.EventListeners.Core.SETUP_ERROR);
if (waiter.config.successType === 'error') {
request.on('extractError', function (resp) {
- var success = waiter.checkError(waiter, resp);
+ var success = waiter.checkError(resp);
if (!success) {
resp.data = null;
resp.error = AWS.util.error(new Error(), {
@@ -101,7 +101,7 @@ AWS.ResourceWaiter = inherit({
} else {
request.removeAllListeners('extractError');
request.on('extractData', function (resp) {
- var success = waiter.checkSuccess(waiter, resp);
+ var success = waiter.checkSuccess(resp);
if (!success) {
resp.data = null;
resp.error = AWS.util.error(new Error(), {
@@ -135,20 +135,20 @@ AWS.ResourceWaiter = inherit({
* Checks if the terminal expected success state has been met
* @return [Boolean]
*/
- checkSuccess: function checkSuccess(waiter, resp) {
- if (!waiter.config.successPath) {
+ checkSuccess: function checkSuccess(resp) {
+ if (!this.config.successPath) {
return resp.httpResponse.statusCode < 300;
}
- var r = AWS.util.jamespath.find(waiter.config.successPath, resp.data);
+ var r = AWS.util.jamespath.find(this.config.successPath, resp.data);
- if (waiter.config.failureValue &&
- waiter.config.failureValue.indexOf(r) >= 0) {
+ if (this.config.failureValue &&
+ this.config.failureValue.indexOf(r) >= 0) {
return null; // fast fail
}
- if (waiter.expectedValue) {
- return r === waiter.expectedValue;
+ if (this.expectedValue) {
+ return r === this.expectedValue;
} else {
return r ? true : false;
}
@@ -158,8 +158,8 @@ AWS.ResourceWaiter = inherit({
* Checks if the terminal expected error state has been met
* @return [Boolean]
*/
- checkError: function checkError(waiter, resp) {
- return resp.httpResponse.statusCode === waiter.config.successValue;
+ checkError: function checkError(resp) {
+ return resp.httpResponse.statusCode === this.config.successValue;
},
/**

0 comments on commit 4e8b4ec

Please sign in to comment.