Skip to content

Commit

Permalink
Catch exception when wrong value passed to scala.Enumerarion.
Browse files Browse the repository at this point in the history
  • Loading branch information
takeshita committed Jun 11, 2012
1 parent 5777d65 commit 6744ef1
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -276,7 +276,11 @@ class ScalaBuildContext(builder : JavassistScalaTemplateBuilder) extends BuildCo

def readEnumValue(builder : StringBuilder , index : Int , entry : ScalaFieldEntry) = {
builder.append("""
_$$_t.%s_$eq( %s.apply($1.int()));""".format(entry.getName,entry.getType.getName))
try{
_$$_t.%s_$eq( %s.apply($1.int()));
}catch(Exception e)
_$$_t.%s_$eq(null);
}""".format(entry.getName,entry.getType.getName,entry.getName))
}


Expand Down

0 comments on commit 6744ef1

Please sign in to comment.