Open dineshbvadhia opened 1 year ago
Using the custom subclass example at https://github.com/vapor-ware/fastapi-rfc7807/blob/master/examples/basic.py, I have a similar construct below. However, I don't understand why it returns a str and not json. The fastapi-rfc7807 code processing the custom subclass is at https://github.com/vapor-ware/fastapi-rfc7807/blob/46dd14254d4aa09a6180adfb563a018b710ba0a1/fastapi_rfc7807/middleware.py#L110
My code is:
from fastapi_rfc7807.middleware import Problem class TableNotFoundError(Problem): """ """ headers = { 'WWW-Authenticate': 'Bearer', } def __init__(self, msg: str) -> None: super(TableNotFoundError, self).__init__( status=500, detail=msg, ) try: do_something(name) except: raise TableNotFoundError("Unknown table: %r" % name)
The response is:
TableNotFoundError: Problem:<{'type': 'about:blank', 'title': 'Internal Server Error', 'status': 500, 'detail': "Unknown table: 'hippo'"}>
Using the custom subclass example at https://github.com/vapor-ware/fastapi-rfc7807/blob/master/examples/basic.py, I have a similar construct below. However, I don't understand why it returns a str and not json. The fastapi-rfc7807 code processing the custom subclass is at https://github.com/vapor-ware/fastapi-rfc7807/blob/46dd14254d4aa09a6180adfb563a018b710ba0a1/fastapi_rfc7807/middleware.py#L110
My code is:
The response is:
TableNotFoundError: Problem:<{'type': 'about:blank', 'title': 'Internal Server Error', 'status': 500, 'detail': "Unknown table: 'hippo'"}>