title: Which exception to throw when I find my data in inconsistent state in Scala?
body: <p>I have a small Scala program which reads data from a data source. This data source is currently a .csv file, so it can contain data inconsistencies. </p>
  
  <p>When implementing a repository pattern for my data, I implemented a method which will return an object by a specific field which should be unique. However, I can't guarantee that it will really be unique, as in a .csv file, I can't enforce data quality in a way I could in a real database. </p>
  
  <p>So, the method checks whether there are one or zero objects with the requested field value in the repository, and that goes well. But I don't know Scala well (or Java for that matter), and the charts of the Java exception hierarchy which I found were not very helpful. Which would be the appropriate exception to throw if there are two objects with the same supposedly unique value. What should I use? </p>