globality-corp / microcosm-postgres

Opinionated persistence with PostgreSQL
Apache License 2.0
4 stars 7 forks source link

Misc improvements #143

Closed JP-Globality closed 1 year ago

JP-Globality commented 1 year ago

From this:

def encode(self, value: list[T]) -> str:
>       return json.dumps([self.element_encoder.encode(element) for element in value])
E       TypeError: 'NoneType' object is not iterable

To this:

self = <microcosm_postgres.encryption.v2.encoders.ArrayEncoder object at 0x111830d60>, value = None

    def wrapped(self, value):
        try:
            return func(self, value)
        except Exception as e:
>           raise Encoder.EncodeException(f"Failed to encode value {value}") from e
E           microcosm_postgres.encryption.v2.encoders.Encoder.EncodeException: Failed to encode value None