Permalink
Browse files

changend require('sys') to require('util')

added a try catch block around the XML parsing
  • Loading branch information...
1 parent f3340a0 commit 30673b8b87ce84854f01e0d7c4c5d9978734445f Joris Röling committed Nov 15, 2011
Showing with 14 additions and 9 deletions.
  1. +1 −1 README.md
  2. +1 −1 bin/restler
  3. +1 −1 lib/multipartform.js
  4. +9 −4 lib/restler.js
  5. +1 −1 test/restler.js
  6. +1 −1 test/test_helper.js
View
@@ -82,7 +82,7 @@ All of these attempt to turn the response into a JavaScript object. In order to
Example usage
-------------
- var sys = require('sys'),
+ var sys = require('util'),
rest = require('./restler');
rest.get('http://google.com').on('complete', function(data) {
View
@@ -2,7 +2,7 @@
require.paths.push(process.cwd());
-var sys = require('sys'),
+var sys = require('util'),
rest = require('../lib/restler'),
repl = require('repl');
@@ -1,5 +1,5 @@
var fs = require('fs');
-var sys = require("sys")
+var sys = require('util')
exports.defaultBoundary = '48940923NODERESLTER3890457293';
View
@@ -1,4 +1,4 @@
-var sys = require('sys'),
+var sys = require('util'),
http = require('http'),
https = require('https'),
url = require('url'),
@@ -233,15 +233,20 @@ try {
parser.on('end', function(result) {
callback(result);
});
-
- parser.parseString(data);
+ try {
+ parser.parseString(data);
+ } catch (e) {
+ callback({error:'Oops, something went wrong.'});
+ }
} else {
callback();
}
};
parsers.auto.matchers['application/xml'] = parsers.xml;
-} catch(e) {}
+} catch(e) {
+ console.log(e);
+}
function Service(defaults) {
View
@@ -1,6 +1,6 @@
var helper = require('./test_helper'),
rest = require('../lib/restler'),
- sys = require('sys');
+ sys = require('util');
helper.testCase("Basic Tests", helper.echoServer, {
testRequestShouldTakePath: function(host, test) {
View
@@ -1,5 +1,5 @@
var http = require("http"),
- sys = require('sys'),
+ sys = require('util'),
test = require('assert');
exports.echoServer = function() {

0 comments on commit 30673b8

Please sign in to comment.