9

I really fucking hate adding Exceptions into code. It's so fucking ugly and I feel miserable sometimes by using because I have to. I'm weird.

Comments
  • 3
    No I'm the same way. I hate it when there's not a way to recover but its usually the users fault when those happen
  • 0
    Glad to hear I'm not the only one struggling with it.
  • 1
    I always feel dirty from it. It's like, my code should be able to handle everything. I don't want to halt it, even though I need to.
  • 0
    A good justifiable example is testable methods for fetch database queries.

    I like my method, output to be uniform. CUD (Create Update Delete) methods can return boolean to indicate if the operation was a success or not. With fetch, success must be returned data, or an empty object/array.

    In this circumstance I can justify returning an exception, and writing a test to assert there are no exceptions; I can then extrapolate that returned null data I'd a successful query with no matches/ zero in the case of counts; and that everything else is a match.
Add Comment