diff --git a/README.md b/README.md index c1b04e17b..f78fe2cb1 100644 --- a/README.md +++ b/README.md @@ -63,10 +63,11 @@ I've been bad about cutting actual releases, so check this repo for recent commi ### Local Development 1. Run `npm install`. -2. Run `npm run start:development:server` and `npm run start:development:client` in separate terminal instances. +2. Run `npm run build`. +3. Run `npm run start:development:server` and `npm run start:development:client` in separate terminal instances. * `npm run start:development:server` uses [nodemon](https://github.com/remy/nodemon) to watch for changes to the server-side JavaScript. * `npm run start:development:client` watches for changes in the client-side source. -3. Access the UI in your browser. Defaults to `localhost:4200`. +4. Access the UI in your browser. Defaults to `localhost:4200`. ### Environment Variables diff --git a/server/util/ajaxUtil.js b/server/util/ajaxUtil.js index 55f0fdf70..9e0d90d5d 100644 --- a/server/util/ajaxUtil.js +++ b/server/util/ajaxUtil.js @@ -11,6 +11,12 @@ const ajaxUtil = { }; } + if (typeof error === 'object' && error.faultString !== undefined) { + error = { + message: error.faultString, + } + } + res.status(500).json(error); } else { res.json(data); diff --git a/server/util/rTorrentDeserializer.js b/server/util/rTorrentDeserializer.js index 3726caea0..6093dff5b 100644 --- a/server/util/rTorrentDeserializer.js +++ b/server/util/rTorrentDeserializer.js @@ -6,6 +6,7 @@ let tmpData; let dataIsVal; let endOfResponse; let rejectCallback; +let fault; const openTag = elementName => { if (elementName === 'array' || elementName === 'struct') { @@ -74,6 +75,10 @@ const closeTag = elementName => { case 'member': break; + case 'fault': + fault = true; + break; + default: rejectCallback(`Unexpected XML-RPC Tag: ${elementName}`); } @@ -85,6 +90,7 @@ const deserialize = (data, resolve, reject) => { tmpData = []; dataIsVal = false; endOfResponse = false; + fault = false; rejectCallback = reject; const parser = new saxen.Parser(); parser.on('openTag', openTag); @@ -93,6 +99,9 @@ const deserialize = (data, resolve, reject) => { parser.on('error', onError); parser.parse(data); if (endOfResponse) { + if (fault) { + return reject(dataStack[0]); + } return resolve(dataStack[0]); } return reject('truncated response was received');