By the way, I do not know if you have ever covered it or not, but I would love to see your technique of designing and implementing custom exceptions for a general application (that is fairly complex and huge). How do you handle their respective logs? How do you decide what information to expose to the clients using the application as logs (may be in the terminal or a separate log file) and what to send to a more dev-centric log file (if any)? How do you tackle exceptions arising due to another exception in logs? Also, (this is more opinionated, I suppose) do you find the use of things like Liskov's Substitutions within Exceptions reasonable (and why)?
These are all great questions, most of which are answered in one of my pet projects at work: github.com/SatelliteQE/broker. In that project, you can find the custom exceptions I use and how logging is handled when in different log levels. Another interesting thing I've introduced with this is an "Emitter" class that can be used for a more structured log-like file that can be more easily consumed in CI environments. github.com/SatelliteQE/broker/blob/master/broker/helpers.py#L269 Now regarding LSP, I'm not very strict when it comes to adhering to most paradigms, if the situation you're in requires some kind of deviation. With that said, my exception subclasses are typically very lightweight.
I've not had a need to use that library, but it does look interesting. If your environment allows third party libraries, that looks like a good alternative. I'll add it to my list for a future series on great packages from PyPi, thanks!
What are some ways that you've used JSON in Python?
Have you used the CLI tool I showed in the last section of the video?
The last technique is genius! No matter how easy or accessible the topic is, every time I watch your video - I always go out learning something new.
What a great video! I don't know how you don't have more views. It's a crime!
really great explanation! Thank You, Jake!
By the way, I do not know if you have ever covered it or not, but I would love to see your technique of designing and implementing custom exceptions for a general application (that is fairly complex and huge). How do you handle their respective logs? How do you decide what information to expose to the clients using the application as logs (may be in the terminal or a separate log file) and what to send to a more dev-centric log file (if any)? How do you tackle exceptions arising due to another exception in logs? Also, (this is more opinionated, I suppose) do you find the use of things like Liskov's Substitutions within Exceptions reasonable (and why)?
These are all great questions, most of which are answered in one of my pet projects at work: github.com/SatelliteQE/broker.
In that project, you can find the custom exceptions I use and how logging is handled when in different log levels. Another interesting thing I've introduced with this is an "Emitter" class that can be used for a more structured log-like file that can be more easily consumed in CI environments.
github.com/SatelliteQE/broker/blob/master/broker/helpers.py#L269
Now regarding LSP, I'm not very strict when it comes to adhering to most paradigms, if the situation you're in requires some kind of deviation. With that said, my exception subclasses are typically very lightweight.
@@JakeCallahan Sounds interesting! Thanks for the recommendation!
Is it better if using orjson ?
I've not had a need to use that library, but it does look interesting. If your environment allows third party libraries, that looks like a good alternative.
I'll add it to my list for a future series on great packages from PyPi, thanks!