Handle IllegalArgumentException in enum valueOf