From 113806b1bc3f6be630d7ed508bd24741b1d07b76 Mon Sep 17 00:00:00 2001 From: Amy Chisholm Date: Wed, 3 Jul 2024 09:00:18 -0700 Subject: [PATCH] refactor: got rid of redundant isExpected in Exception class --- lib/errors/index.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/errors/index.js b/lib/errors/index.js index 6b9202ced6..9713b7777f 100644 --- a/lib/errors/index.js +++ b/lib/errors/index.js @@ -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 - } } /**