Skip to content

Box method ~> behaviour on ParamFailure #1680

@regb

Description

@regb

Current behaviour of ~> on a ParamFailure is to override the parameter with the new parameter passed to >. This means that when applying two successive >, the last application will be used. This is in contrast to the current behaviour of ?, which only use the first application, and ignore the following ones (if the Box is already a Failure, applying ? will return the same failure).

A use case illustrating the poential issue:
for {
id <- S.param("id") ?~ "Missing id" > 400
item <- (DB.find(id) ?
"Item not found" > 404).filter(canViewItem) ? "Unauthorized access to item" ~> 403
} yield ???

In case the item id is not in the DB, the message will be "item not found" along with error code 403, which is very counter-intuitive.

Discussion started in the google group: https://groups.google.com/forum/#!topic/liftweb/IMJqy2aMtXk

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions