Skip to main content

All Questions

Filter by
Sorted by
Tagged with
4 votes
3 answers
9k views

When to add a precondition and when to (only) throw an exception?

I am learning about preconditions and when to use them. I have been told that the precondition @pre fileName must be the name of a valid file does not suit in the following code: /** Creates a new ...
Datoraki's user avatar
  • 1,223