r-ss / foldwrap_backend

backend part of my Foldwrap project
https://foldwrap.com
0 stars 0 forks source link

DAO review suggestions #9

Open Sheihesinusslon opened 10 months ago

Sheihesinusslon commented 10 months ago

https://github.com/r-ss/foldwrap_backend/blob/5c4437e439ad34e534e4b05bd16d9c2818b86d4e/src/dao/oid.py#L35 there is sometimes a big argument if assert statements should be used in the code. asserts can be disabled in PROD code. that is why there is another approach: you check the type as isinstance(), and if not, then you raise a custom business exception. Smth like

class FoldWrapValidationException(Exception):
    pass

...
if not isinstance(source_type, OID):
    raise FoldWrapValidationException("Some meaningful message")

Duplication OID class ? https://github.com/r-ss/foldwrap_backend/blob/5c4437e439ad34e534e4b05bd16d9c2818b86d4e/src/dao/dao.py#L26

https://github.com/r-ss/foldwrap_backend/blob/5c4437e439ad34e534e4b05bd16d9c2818b86d4e/src/dao/ress_redis.py#L6-L15 the usual, host names, ports and reddis exp time keep in configs