You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@JelleZijlstra There are lots of places where we raise exception. This is common practice. Any work around? In django codebase, raising exception is a common thing.
Mypy can't check that exceptions are correctly caught or annotated, so your best is to document them in a docstring or invent some custom way of annotating them (but that won't be checked by mypy).
Activity
JelleZijlstra commentedon Dec 20, 2018
Exceptions should not be included in the return type. Your
postfunction should simply returnrequests.models.Response.The Python type system doesn't provide a way to specify what exceptions may be raised from a function.
sp1rs commentedon Dec 20, 2018
@JelleZijlstra There are lots of places where we raise exception. This is common practice. Any work around? In django codebase, raising exception is a common thing.
JukkaL commentedon Dec 20, 2018
Mypy can't check that exceptions are correctly caught or annotated, so your best is to document them in a docstring or invent some custom way of annotating them (but that won't be checked by mypy).