Skip to content

Commit

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

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

// Consumers can distinguish users errors from system bugs by checking
Expand Down

0 comments on commit 1a17730

Please sign in to comment.