diff --git a/package.json b/package.json index c025ada2..a10d5a16 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.25.2", + "version": "3.26.0", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/src/channel-storage/dbstore.js b/src/channel-storage/dbstore.js index fc2cedaf..cfbe1ea3 100644 --- a/src/channel-storage/dbstore.js +++ b/src/channel-storage/dbstore.js @@ -77,10 +77,11 @@ export class DatabaseStore { } if (totalSize > SIZE_LIMIT) { - throw new ChannelStateSizeError('Channel state size is too large', { + return Promise.reject(new ChannelStateSizeError( + 'Channel state size is too large', { limit: SIZE_LIMIT, actual: totalSize - }); + })); } return queryAsync(buildUpdateQuery(rowCount), substitutions); diff --git a/src/channel-storage/filestore.js b/src/channel-storage/filestore.js index 070112e6..3ea6384f 100644 --- a/src/channel-storage/filestore.js +++ b/src/channel-storage/filestore.js @@ -20,10 +20,11 @@ export class FileStore { const filename = this.filenameForChannel(channelName); return statAsync(filename).then(stats => { if (stats.size > SIZE_LIMIT) { - throw new ChannelStateSizeError('Channel state file is too large', { + return Promise.reject( + new ChannelStateSizeError('Channel state file is too large', { limit: SIZE_LIMIT, actual: stats.size - }); + })); } else { return readFileAsync(filename); } @@ -31,7 +32,7 @@ export class FileStore { try { return JSON.parse(fileContents); } catch (e) { - throw new Error('Channel state file is not valid JSON: ' + e); + return Promise.reject(new Error('Channel state file is not valid JSON: ' + e)); } }); }