enumeratum icon indicating copy to clipboard operation
enumeratum copied to clipboard

Unhelpful NSEE from namesToValuesMap

Open halfninja opened this issue 6 years ago • 1 comments

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.

halfninja avatar Sep 24 '19 12:09 halfninja

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

lloydmeta avatar Sep 25 '19 01:09 lloydmeta