Skip to content

Commit 38f9825

Browse files
authoredJul 3, 2024··
refactor: got rid of redundant isExpected in the Exception class (#2328)
1 parent 6eddb72 commit 38f9825

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed
 

‎lib/errors/index.js

+9-10
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,18 @@ class Exception {
3131

3232
getErrorDetails(config) {
3333
const errorDetails = errorHelper.extractErrorInformation(null, this.error, config)
34-
errorDetails.expected = this.isExpected(config, errorDetails)
35-
36-
return errorDetails
37-
}
38-
39-
isExpected(config, { type, message }) {
4034
if (typeof this._expected === 'undefined') {
41-
this._expected =
42-
errorHelper.isExpectedErrorClass(config, type) ||
43-
errorHelper.isExpectedErrorMessage(config, type, message)
35+
this._expected = errorHelper.isExpected(
36+
errorDetails.type,
37+
errorDetails.message,
38+
null,
39+
config,
40+
urltils
41+
)
4442
}
43+
errorDetails.expected = this._expected
4544

46-
return this._expected
45+
return errorDetails
4746
}
4847
}
4948

0 commit comments

Comments
 (0)
Please sign in to comment.