diff --git a/src/error.js b/src/error.js index d629d44..fece4c5 100644 --- a/src/error.js +++ b/src/error.js @@ -1,13 +1,9 @@ import PluginError from 'plugin-error' -export const throwError = (error, opts) => { - throw createError(error, opts) -} - -// Build a Gulp error, so it prints better. +// Throw a Gulp error, so it prints better. // By passing `error`, we make sure `error` properties (e.g. from `execa`) // are kept. They are not printed though, as error message should be enough. -export const createError = (error, opts) => { +export const throwError = (error, opts) => { const errorA = error instanceof Error ? error : new Error(error) if (errorA.shortMessage !== undefined) { @@ -17,7 +13,7 @@ export const createError = (error, opts) => { delete errorA.shortMessage } - return new PluginError({ ...PLUGIN_ERROR_OPTS, ...opts, error: errorA }) + throw new PluginError({ ...PLUGIN_ERROR_OPTS, ...opts, error: errorA }) } const PLUGIN_ERROR_OPTS = { diff --git a/src/stream/result.js b/src/stream/result.js index 33a379e..bd3deb5 100644 --- a/src/stream/result.js +++ b/src/stream/result.js @@ -1,6 +1,5 @@ import { Buffer } from 'node:buffer' -import { createError } from '../error.js' import { execCommand, streamCommand } from '../exec.js' import { isValidInput } from '../input.js' @@ -46,7 +45,7 @@ const saveResult = async ({ file, file: { execa }, input, opts }) => { file.execa = [...execa, execaResult] } -const streamResult = ({ file, input, opts, opts: { from } }) => { +const streamResult = ({ file, input, opts }) => { // eslint-disable-next-line no-param-reassign, fp/no-mutation file.contents = streamCommand(input, opts) }