From 3fa9ff41fa87ed2e258ce4277f91944fcf1d4436 Mon Sep 17 00:00:00 2001 From: Kieran Prasch Date: Fri, 24 Nov 2023 14:42:36 +0100 Subject: [PATCH] Refactor EvalError as an exception class. --- nucypher/policy/conditions/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nucypher/policy/conditions/utils.py b/nucypher/policy/conditions/utils.py index 82765c1a2c..4dabce5c9e 100644 --- a/nucypher/policy/conditions/utils.py +++ b/nucypher/policy/conditions/utils.py @@ -1,6 +1,6 @@ import re from http import HTTPStatus -from typing import Dict, NamedTuple, Optional, Tuple +from typing import Dict, Optional, Tuple from marshmallow import Schema, post_dump from web3.providers import BaseProvider @@ -21,9 +21,10 @@ __LOGGER = Logger("condition-eval") -class EvalError(NamedTuple): - message: str - status_code: int +class EvalError(Exception): + def __init__(self, message: str, status_code: int): + self.message = message + self.status_code = status_code def to_camelcase(s): @@ -132,7 +133,6 @@ def evaluate_condition_lingo( log.warn(message) if error: - error = EvalError(*error) log.info(error.message) # log error message return error