When you write code, sometimes we feel its fragile - yet we're not sure why. Currently, I'm working on a project and I feel the code is very fragile. It has exception handling, it has retry logic, and it has data that is returned to the user to handle any issues that arise. How else can we ensure its not fragile?
There are unit tests and refactoring elements happening, but I still feel its too fragile at its core. What else can I do?
Top comments (2)
What makes you think your code is fragile?
I'm not sure actually. I call out to an API that returns a result - whether good or bad, and I react with Good continuing what its doing, otherwise, it results in exceptions being thrown. Depending on where the exception happens, the user will either get the exception thrown to them or the resulting data will contain the elements and which ones were errors.
I feel like I could call this improperly and not get a result, but constantly get a crash/exception thrown. Maybe its because its open and not locked down to something specific? I'm only expecting certain things for the user to pass in. If they don't pass in at least the minimum results, they'll get an exception.
Maybe that's it, maybe I'm not checking more thoroughly what they're sending in to verify it can be processed.