THRIFT-1267 Node.js can't throw exceptions
Patch: Henrique Mendonca
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1230797 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/nodejs/examples/Makefile b/lib/nodejs/examples/Makefile
index 1930279..b4283dc 100644
--- a/lib/nodejs/examples/Makefile
+++ b/lib/nodejs/examples/Makefile
@@ -14,5 +14,11 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-ALL:
+all:
../../../compiler/cpp/thrift --gen js:node user.thrift
+
+server: all
+ NODE_PATH=../lib:../lib/thrift node server.js
+
+client: all
+ NODE_PATH=../lib:../lib/thrift node client.js
diff --git a/lib/nodejs/examples/server.js b/lib/nodejs/examples/server.js
index 3b8c046..1c482fe 100644
--- a/lib/nodejs/examples/server.js
+++ b/lib/nodejs/examples/server.js
@@ -24,15 +24,15 @@
var users = {};
var server = thrift.createServer(UserStorage, {
- store: function(user, success) {
+ store: function(user, result) {
console.log("server stored:", user.uid);
users[user.uid] = user;
- success();
+ result(null);
},
- retrieve: function(uid, success) {
+ retrieve: function(uid, result) {
console.log("server retrieved:", uid);
- success(users[uid]);
+ result(null, users[uid]);
},
});
diff --git a/lib/nodejs/examples/server_multitransport.js b/lib/nodejs/examples/server_multitransport.js
index e5d6d76..7f9b8fb 100644
--- a/lib/nodejs/examples/server_multitransport.js
+++ b/lib/nodejs/examples/server_multitransport.js
@@ -6,14 +6,14 @@
var users = {};
-var store = function(user, success) {
+var store = function(user, result) {
console.log("stored:", user.uid);
users[user.uid] = user;
- success();
+ result(null);
};
-var retrieve = function(uid, success) {
+var retrieve = function(uid, result) {
console.log("retrieved:", uid);
- success(users[uid]);
+ result(null, users[uid]);
};
var server_framed = thrift.createServer(UserStorage, {