【发布时间】:2019-04-17 20:20:14
【问题描述】:
在我的烧瓶应用程序中,由于以下代码行,我无法抛出错误。
请注意,MyException 是 Exception 类的子类,它从 flask_api 导入状态。
raise MyException(
status.HTTP_400_BAD_REQUEST, "File does not exist: " + file_path
)
但是,当我在网页中遇到此错误时,这会在我的终端中产生以下错误:
TypeError: 'tuple' object is not callable
The view function did not return a valid response. The return type must be a string, tuple, Response instance, or WSGI callable, but it was a tuple.
我无法在烧瓶中引发异常吗?
【问题讨论】: