From 5f0c508fedf4d744aed9de63cc9e2618bff30cc9 Mon Sep 17 00:00:00 2001 From: Madhur Tandon <20173739+madhur-tandon@users.noreply.github.com> Date: Wed, 9 Nov 2022 03:13:18 +0530 Subject: [PATCH] use user error for paths calculation (#927) --- pyscriptjs/src/plugins/fetch.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyscriptjs/src/plugins/fetch.ts b/pyscriptjs/src/plugins/fetch.ts index 971b91d1..4901b76d 100644 --- a/pyscriptjs/src/plugins/fetch.ts +++ b/pyscriptjs/src/plugins/fetch.ts @@ -1,5 +1,6 @@ import { joinPaths } from '../utils'; import { FetchConfig } from "../pyconfig"; +import { UserError } from '../exceptions'; export function calculatePaths(fetch_cfg: FetchConfig[]) { const fetchPaths: string[] = []; @@ -13,7 +14,7 @@ export function calculatePaths(fetch_cfg: FetchConfig[]) { { if (to_file !== undefined) { - throw Error(`Cannot use 'to_file' and 'files' parameters together!`); + throw new UserError(`Cannot use 'to_file' and 'files' parameters together!`); } for (const each_f of files) { @@ -28,7 +29,7 @@ export function calculatePaths(fetch_cfg: FetchConfig[]) { fetchPaths.push(from); const filename = to_file || from.split('/').pop(); if (filename === '') { - throw Error(`Couldn't determine the filename from the path ${from}, supply ${to_file} parameter!`); + throw new UserError(`Couldn't determine the filename from the path ${from}, supply ${to_file} parameter!`); } else { paths.push(joinPaths([to_folder, filename]));