Skip to content

Commit

Permalink
Merge pull request #58 from ubergoob/master
Browse files Browse the repository at this point in the history
context object methods cleanup
  • Loading branch information
Tim-B committed Jan 23, 2016
2 parents 1279812 + f544e42 commit dd8a75b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tasks/lambda_invoke.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,26 @@ module.exports = function (grunt) {

var context = {
done: function (error, result) {
if (error === null) {
this.succeed(result);
if (error === null || typeof(error) === 'undefined') {
context.succeed(result);
} else {
this.fail(error);
context.fail(error);
}
},
succeed: function (result) {
grunt.log.writeln("");
grunt.log.writeln("Success! Message:");
grunt.log.writeln("------------------");
grunt.log.writeln(result);
var msg = (typeof(result) === 'object') ? JSON.stringify(result) : result;
grunt.log.writeln((typeof(result) !== 'undefined') ? msg : "Successful!");
done(true);
},
fail: function (error) {
grunt.log.writeln("");
grunt.log.writeln("Failure! Message:");
grunt.log.writeln("------------------");
grunt.log.writeln(error);
var msg = (typeof(error) === 'object') ? JSON.stringify(error) : error;
grunt.log.writeln((typeof(error) !== 'undefined') ? msg : "Error not provided.");
done(false);
},
awsRequestId: 'LAMBDA_INVOKE',
Expand Down

0 comments on commit dd8a75b

Please sign in to comment.