Skip to content

Commit

Permalink
Refactor EvalError as an exception class.
Browse files Browse the repository at this point in the history
  • Loading branch information
KPrasch committed Nov 24, 2023
1 parent 546a37d commit c114498
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions nucypher/policy/conditions/utils.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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

0 comments on commit c114498

Please sign in to comment.