Created
January 18, 2011 00:33
-
-
Save wfaler/783786 to your computer and use it in GitHub Desktop.
OptionMapper.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def `GET /widgets/:id`(widget: Option[Widget]) = render(widget) |
Hi, thanks for the pointer.
This was actually fixed in the last few days (though not yet in the example app, which lags a little behind) - there was a bug in Bowler core where rendering null or None resulted in an exception when it shouldn't - now it checks for options and unwraps them for rendering if it is a "Some".
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not quite idiomatic Scala. How about:
def render(maybeWidget: Option[Widget])
so that clients might simply call:
render(widget)
whether it be None or Some.