Jean-Luc <[email protected]> writes:

> *open_!*  can be very convenient, but it can throw unexpected exceptions.
> Better to avoid its use whenever possible.
>
> And what about something like that :
>
> val username = User.find(id).map(_.name) getOrElse "User not found"
>
> or
>
> val username = (for(user <- User.find(id)) yield user.name) getOrElse "User
> not found"

Or

val username = User.find(id).dmap("User not found")(_.name)

/Jeppe


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to