Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 29, 2022
1 parent 1a17730 commit 8edbfb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/config/normalize/lib/call/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import {
} from './suffix.js'

// Handle errors in `keyword.test|normalize|main()` or in keyword functions
export const handleError = function ({ error, errorType, bugType, ...opts }) {
export const handleError = function ({ error, errorType, bugType, ...params }) {
const isValidation = isValidateError(error)
const type = isValidation ? errorType : bugType
return ERROR_HANDLERS[type]({ ...opts, error, isValidation })
return ERROR_HANDLERS[type]({ ...params, error, isValidation })
}

// Consumers can distinguish users errors from system bugs by checking
Expand Down
26 changes: 4 additions & 22 deletions src/config/normalize/lib/call/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,33 +88,15 @@ export const callMain = async function ({
// - Error handled
const callFunc = async function ({
func,
input,
info: { originalName },
info: { example, prefix, ...info },
hasInput,
test,
keyword,
definition,
exampleDefinition,
errorType,
bugType,
...params
}) {
const { input, hasInput } = params

try {
return hasInput ? await func(input, info) : await func(info)
} catch (error) {
throw handleError({
error,
input,
example,
prefix,
originalName,
hasInput,
test,
keyword,
definition,
exampleDefinition,
errorType,
bugType,
})
throw handleError({ ...params, error, example, prefix, originalName })
}
}

0 comments on commit 8edbfb4

Please sign in to comment.