You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/10/30 20:41:16 UTC

[GitHub] houshengbo closed pull request #97: serialize errors

houshengbo closed pull request #97: serialize errors
URL: https://github.com/apache/incubator-openwhisk-runtime-nodejs/pull/97
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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) });
                     }
                 });
             }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services