Skip to content

Return a response object from methods #134

Closed
@bcb

Description

@bcb

Currently we're raising an InvalidParamsError or ApiError to return a failure response.

@method
def fruits(color):
    if color not in ("red", "orange", "yellow"):
        raise InvalidParamsError("No fruits of that colour")

I would prefer not to raise an exception for these, because it

  1. uses exceptions to control flow
  2. makes the @method a partial function
  3. goes against the functional style of the rest of the library

Instead we should return an error response.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions