Skip to content

Commit

Permalink
refactor: got rid of redundant isExpected in the Exception class (#2328)
Browse files Browse the repository at this point in the history
  • Loading branch information
amychisholm03 authored Jul 3, 2024
1 parent 6eddb72 commit 38f9825
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions lib/errors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,18 @@ class Exception {

getErrorDetails(config) {
const errorDetails = errorHelper.extractErrorInformation(null, this.error, config)
errorDetails.expected = this.isExpected(config, errorDetails)

return errorDetails
}

isExpected(config, { type, message }) {
if (typeof this._expected === 'undefined') {
this._expected =
errorHelper.isExpectedErrorClass(config, type) ||
errorHelper.isExpectedErrorMessage(config, type, message)
this._expected = errorHelper.isExpected(
errorDetails.type,
errorDetails.message,
null,
config,
urltils
)
}
errorDetails.expected = this._expected

return this._expected
return errorDetails
}
}

Expand Down

0 comments on commit 38f9825

Please sign in to comment.