bananaml / potassium

An HTTP serving framework by Banana
Apache License 2.0
97 stars 9 forks source link

Cleaner error msg for response objects #14

Closed kylejmorris closed 1 year ago

kylejmorris commented 1 year ago

What is this?

Simpler error message if Response is formatted wrong

Why?

Original msg was cryptic and caused me confusion.

Before TypeError: The view function did not return a valid response. The return type must be a string, dict, list, tuple with headers or status, Response instance, or WSGI callable, but it was a set.

Now Unable to create valid Potassium Response, please ensure your Response objects contain valid json, status code)

How did you test it works without regressions?

Tested local with failed json return, tested with np array return (threw expected error json can't be serialized), success case returns

If this is a new feature what may a critical error (P0) look like?

N/a given it's already an exception being thrown.

Things to consider to not repeat mistakes we've learned from many times

kylejmorris commented 1 year ago

Pypi pkg updated to 0.0.10, merging now.