Skip to content

Commit

Permalink
refactor: got rid of redundant isExpected in Exception class
Browse files Browse the repository at this point in the history
  • Loading branch information
amychisholm03 committed Jul 3, 2024
1 parent 6eddb72 commit 113806b
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions lib/errors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,16 @@ class Exception {

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

return errorDetails
}

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

return this._expected
}
}

/**
Expand Down

0 comments on commit 113806b

Please sign in to comment.