Skip to content

Commit

Permalink
fix(filesystem): Throw errors instead of strings (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Jan 5, 2022
1 parent a2546cd commit af4b875
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions filesystem/src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class FilesystemWeb extends WebPlugin implements FilesystemPlugin {

const occupiedEntry = (await this.dbRequest('get', [path])) as EntryObj;
if (occupiedEntry && occupiedEntry.type === 'directory')
throw 'The supplied path is a directory.';
throw Error('The supplied path is a directory.');

const encoding = options.encoding;
const parentPath = path.substr(0, path.lastIndexOf('/'));
Expand Down Expand Up @@ -224,7 +224,7 @@ export class FilesystemWeb extends WebPlugin implements FilesystemPlugin {

const occupiedEntry = (await this.dbRequest('get', [path])) as EntryObj;
if (occupiedEntry && occupiedEntry.type === 'directory')
throw 'The supplied path is a directory.';
throw Error('The supplied path is a directory.');

const parentEntry = (await this.dbRequest('get', [parentPath])) as EntryObj;
if (parentEntry === undefined) {
Expand Down

0 comments on commit af4b875

Please sign in to comment.