Skip to content

Commit

Permalink
Now throw an Error when the 'SimpleVirtualStoredContentManager' insta…
Browse files Browse the repository at this point in the history
…nce is not initialized, helping for debugging
  • Loading branch information
AdrienCastex committed Jun 4, 2017
1 parent e2e054c commit c3eb727
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 2 additions & 4 deletions lib/manager/VirtualStoredFSManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ var SimpleVirtualStoredContentManager = (function (_super) {
};
SimpleVirtualStoredContentManager.prototype._allocate = function (options, _callback) {
var callback = function (_1, _2) { return process.nextTick(function () { return _callback(_1, _2); }); };
if (!this.initialized) {
callback(new Error('SimpleVirtualStoredContentManager not initialized'), null);
return;
}
if (!this.initialized)
throw new Error('SimpleVirtualStoredContentManager not initialized');
var uid = (++this.cid).toString(16);
fs.open(path.join(this.storeFolderPath, uid), 'w+', function (e, fd) {
if (e)
Expand Down
5 changes: 1 addition & 4 deletions src/manager/VirtualStoredFSManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ export class SimpleVirtualStoredContentManager extends VirtualStoredContentManag
const callback = (_1, _2) => process.nextTick(() => _callback(_1, _2));

if(!this.initialized)
{
callback(new Error('SimpleVirtualStoredContentManager not initialized'), null);
return;
}
throw new Error('SimpleVirtualStoredContentManager not initialized');

const uid = (++this.cid).toString(16);

Expand Down

0 comments on commit c3eb727

Please sign in to comment.