Skip to content

Commit

Permalink
fix(commands/run): throws when task is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Apr 23, 2019
1 parent 7d3baab commit 7906ae7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/commands/run/retrieve.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { IScripts, IOfType, TScript } from '~/types';
import { get } from 'slimconf';
import { Errorish } from 'errorish';

export default function retrieveTask(
name: string,
Expand All @@ -22,7 +21,7 @@ export default function retrieveTask(
}

function kpoRetrieveTask(name: string, kpo: IScripts | null): TScript {
if (!kpo) return null;
if (!kpo) throw Error(`Task ${name} couldn't be found`);

let task: TScript;

Expand All @@ -32,8 +31,8 @@ function kpoRetrieveTask(name: string, kpo: IScripts | null): TScript {
if (item.hasOwnProperty('default')) item = item.default;
}
task = item;
} catch (err) {
throw new Errorish(`Task ${name} couldn't be found`, null, err);
} catch (_) {
throw Error(`Task ${name} couldn't be found`);
}

return task;
Expand Down

0 comments on commit 7906ae7

Please sign in to comment.