Skip to content

Instantly share code, notes, and snippets.

View nguerrera's full-sized avatar
🌴
I no longer work at Microsoft

Nick Guerrera nguerrera

🌴
I no longer work at Microsoft
View GitHub Profile

@davkean's thoughts on "contract breaking" exceptions:

You do not want to derive from InvalidOperationException. It and ArgumentException (and derivatives) are considered "contract breaking" exceptions.

Contract breaking exceptions should only be thrown to indicate that the caller has a bug. I pretend that every time I go to throw these exceptions that the process will be torn down immediately. If I’m okay with that, then I throw it, if not, then I should be throwing a