Like you’re shrugging your shoulders and broadcasting a big “meh”. “Too bad, so sad” is the message you’re conveying. NotSupportedException or NotImplementedException feels like you’re basically giving up on the caller. Do I return an error object of some kind, or should I throw an exception, or do nothing? I ended up thinking that I should throw an exception, but which one? Since I was going to support a specific operation, I reasoned that NotSupportedException was the right one. If the if condition was false, the else was considered handling an error condition, but I really didn’t know what the right approach was. Recently I was writing code for another blog article, and I got to a point where I wanted to write an if– else statement. Here is a story of what I thought would be an easy thing to do in code, but ended up being more of a trial than I expected. Sometimes, a fun challenge can lead one down paths that can frustrate and enlighten the traveler.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |