Skip to content

Property setter errors are eaten by ASGI error #386

Description

@julianstirling

Describe the bug
Functional properties can raise Value errors but the error is not forwarded in the logs, instead it is all wrapped in an ASGI error with no context.

To Reproduce
Create a functional property which can error on some values, a simple example is here (yes this example could be done with the new decorators:

_blob_density: int = 400

    @lt.property
    def blob_density(self) -> int:
        """The number of blobs per million pixels."""
        return self._blob_density

    @blob_density.setter
    def _set_blob_density(self, value: int) -> None:
        if value < 0:
            raise ValueError("Sample density must be >= 0")
        self._blob_density = value
        if self._capture_enabled:
            self.generate_canvas()

Now set blob density to -1

Expected behaviour
I expect the error raised to be Sample density must be >= 0 not Exception in ASGI application with a horrible ASGI stack trace.

System:

  • OS: Kubuntu 24.04
  • Python version: 3.13
  • Version 0.2.1

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions