Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var thrift = require('thrift');
- var test = require('./gen-nodejs/test.js'),
- ttypes = require('./gen-nodejs/test_types');
- var server = thrift.createServer(test, {
- foo: function(bar,response) {
- console.log('Got: '+bar);
- if (bar == 1) {
- console.log('throw MyException');
- response(new ttypes.MyException({code: 0x0211, message: 'Test exception'}));
- } else if (bar == 2) {
- console.log('throw MyOtherException');
- response(new ttypes.MyOtherException({message: 'Test exception'}));
- } else {
- console.log('okay');
- response(null, 1234);
- }
- }
- });
- server.listen(9090);
Add Comment
Please, Sign In to add comment