r/learnSQL • u/sumiitCodes • 4d ago
Day 74 — Hospital Management System: started coding with packages, three classes, and custom exceptions
I moved from planning to coding today:
Several people here suggested planning modules first, handling exceptions carefully, and not putting all the logic in one class, so I tried to follow that from the start.
Next I’ll build one module at a time and test it before moving on.
For people who’ve used custom exceptions in a project like this: how many did you end up needing, and did you group them under a common parent exception?
3
Upvotes
1
u/nullish_ 4d ago
Should be careful with exception handling.. you dont want to catch exceptions only to throw your own and lose the original exception.
1
u/jakingo 4d ago
Start with only the exceptions your project actually needs. You can always add a common parent exception later as the project grows.
1
u/Discordbothost 3d ago
For bookings, I'd start with SlotAlreadyBooked. Translate only the duplicate-slot constraint error into that exception so the UI can offer another time. Keep the original cause for logs, and let connection errors surface separately.