I like to separate two kind of layers I have in my app: logic and application.
Logic is almost independent, it is my choice how to work with it. It allows a huge portion of freedom.
On the other hand it requires to be readable. Because there are no other-projects-like-this-one. So, that's why it is important for me to make exceptions crystal clear. Other people does not know if my FetchUser class is going to raise or not. And I do want to make this contract explicit.
On the lower, application, level I am using the existing stuff. Like django, celery, scrapy. And I need to respect their APIs. And, for example, django uses a lot of exceptions to control the execution flow. So, I prefer to raise on this level. And check that every exception is meaningful with tests.
That's how I see the big picture. Hope that you will find a proper use-cases for returns!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I like to separate two kind of layers I have in my app: logic and application.
Logic is almost independent, it is my choice how to work with it. It allows a huge portion of freedom.
On the other hand it requires to be readable. Because there are no other-projects-like-this-one. So, that's why it is important for me to make exceptions crystal clear. Other people does not know if my
FetchUser
class is going to raise or not. And I do want to make this contract explicit.On the lower, application, level I am using the existing stuff. Like
django
,celery
,scrapy
. And I need to respect their APIs. And, for example,django
uses a lot of exceptions to control the execution flow. So, I prefer to raise on this level. And check that every exception is meaningful with tests.That's how I see the big picture. Hope that you will find a proper use-cases for
returns
!