Refactor EvalError as an exception class.

pull/3358/head
Kieran Prasch 2023-11-24 14:42:36 +01:00 committed by KPrasch
parent 52b99b375c
commit d61a7487dc
1 changed files with 5 additions and 5 deletions

View File

@ -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 @@ from nucypher.utilities.logging import Logger
__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