lloydmeta / enumeratum

A type-safe, reflection-free, powerful enumeration implementation for Scala with exhaustive pattern match warnings and helpful integrations.
MIT License
1.19k stars 149 forks source link

Unhelpful NSEE from namesToValuesMap #254

Open halfninja opened 5 years ago

halfninja commented 5 years ago

Passing an invalid name to namesToValuesMap returns an unhelpful NoSuchElementException with no message to indicate what the invalid value was

> domain.DocType.namesToValuesMap("Greg")
java.util.NoSuchElementException
  at scala.collection.immutable.BitmapIndexedMapNode.apply(HashMap.scala:569)
  at scala.collection.immutable.HashMap.apply(HashMap.scala:132)
  ... 36 elided

Compare to withName which gives a much nicer message, but this doesn't help as enumeratum-slick uses namesToValuesMap, so you could optionally consider this as a bug in SlickEnumColumnSupport.

lloydmeta commented 5 years ago

Yeah, the SlickEnumColumnSupport can def be improved. Please feel free to send a PR.