Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Using a Box / Failure and how to set HTTP status code
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
bg  
View profile  
 More options Oct 12 2012, 10:15 am
From: bg <brentgra...@gmail.com>
Date: Fri, 12 Oct 2012 07:15:04 -0700 (PDT)
Local: Fri, Oct 12 2012 10:15 am
Subject: Re: [Lift] Using a Box / Failure and how to set HTTP status code

Hi guys,

How would I get the message in the "Failure" using a for comprehension.

In my first post - userAllowed functions does some checking, and has
different messages for different scenarios?

for ( extracted <- SomeValue ?~ "param failure error message" # instead of
writing this message, can I look at the Failure and get the message
returned with it? # ~> 401) yield extracted

On Friday, October 12, 2012 10:09:19 AM UTC+1, maarten wrote:

> This returns "extracted" wrapped in a Box[SomeType] assuming that
> SomeValue is if Box[SomeType]:

> for ( extracted <- SomeValue ?~ "param failure error message" ~> 401)
> yield extracted

> Of course you can add processing logic in the yield using a helper
> function (so you get yield f(extracted))

> Does this help?

> --Maarten

> On Friday, October 12, 2012, Naftoli Gugenheim wrote:

>> On Mon, Oct 8, 2012 at 5:49 PM, David Pollak <
>> feeder.of.the.be...@gmail.com> wrote:

>>> Please do not use pattern matching, please use for comprehensions.

>> Why? And, how do you handle the Failure case?

>>  --
>> --
>> Lift, the simply functional web framework: http://liftweb.net
>> Code: http://github.com/lift
>> Discussion: http://groups.google.com/group/liftweb
>> Stuck? Help us help you:
>> https://www.assembla.com/wiki/show/liftweb/Posting_example_code


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.