openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From houshen...@apache.org
Subject [incubator-openwhisk-runtime-nodejs] branch master updated: serialize errors (#97)
Date Tue, 30 Oct 2018 20:41:18 GMT
This is an automated email from the ASF dual-hosted git repository.

houshengbo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-runtime-nodejs.git


The following commit(s) were added to refs/heads/master by this push:
     new d967ebe  serialize errors (#97)
d967ebe is described below

commit d967ebe339256979b759bd2bc37fe3cb6d8daff0
Author: Carlos Santana <csantanapr@apache.org>
AuthorDate: Tue Oct 30 16:41:05 2018 -0400

    serialize errors (#97)
    
    * serialize errors
    Fixes #63
    Fixes #96
    
    * add serialize-error in the correct place duh!
---
 core/nodejs6Action/Dockerfile      | 1 +
 core/nodejs8Action/package.json    | 3 ++-
 core/nodejsActionBase/package.json | 3 ++-
 core/nodejsActionBase/runner.js    | 7 ++-----
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/core/nodejs6Action/Dockerfile b/core/nodejs6Action/Dockerfile
index 99e835f..9440f02 100644
--- a/core/nodejs6Action/Dockerfile
+++ b/core/nodejs6Action/Dockerfile
@@ -73,6 +73,7 @@ request-promise@4.1.1 \
 rimraf@2.5.4 \
 semver@5.3.0 \
 sendgrid@4.7.1 \
+serialize-error@3.0.0 \
 serve-favicon@2.3.2 \
 socket.io@1.6.0 \
 socket.io-client@1.6.0 \
diff --git a/core/nodejs8Action/package.json b/core/nodejs8Action/package.json
index 4eaec3a..36c5bcf 100644
--- a/core/nodejs8Action/package.json
+++ b/core/nodejs8Action/package.json
@@ -10,6 +10,7 @@
   "dependencies": {
     "openwhisk": "3.18.0",
     "body-parser": "1.18.2",
-    "express": "4.16.2"
+    "express": "4.16.2",
+    "serialize-error": "3.0.0"
   }
 }
diff --git a/core/nodejsActionBase/package.json b/core/nodejsActionBase/package.json
index cc0f9d9..8322950 100644
--- a/core/nodejsActionBase/package.json
+++ b/core/nodejsActionBase/package.json
@@ -6,6 +6,7 @@
     "btoa": "1.1.2",
     "express": "4.14.0",
     "log4js": "0.6.38",
-    "request": "2.79.0"
+    "request": "2.79.0",
+    "serialize-error": "3.0.0"
   }
 }
diff --git a/core/nodejsActionBase/runner.js b/core/nodejsActionBase/runner.js
index 1ad7172..7f37e3b 100644
--- a/core/nodejsActionBase/runner.js
+++ b/core/nodejsActionBase/runner.js
@@ -25,6 +25,7 @@ var util = require('util');
 var child_process = require('child_process');
 var fs = require('fs');
 var path = require('path');
+const serializeError = require('serialize-error');
 
 function NodeActionRunner() {
     // Use this ref inside closures etc.
@@ -114,11 +115,7 @@ function NodeActionRunner() {
                     if (!error) {
                         resolve({ error: {}});
                     } else {
-                        // Log stack trace for rejected promises.
-                        if (error.message) {
-                            console.error(error)
-                        }
-                        resolve({ error: error.toString() });
+                        resolve({ error: serializeError(error) });
                     }
                 });
             }


Mime
View raw message