Add exception handling for comet updates #1283

merged 4 commits into from Jul 1, 2012


None yet
3 participants

Shadowfiend commented Jun 25, 2012

As per!topic/liftweb/FFoyKp5H7hE .

The idea is to add LiftRules.cometUpdateExceptionHandler, a FactoryMaker[Box[JsCmd]]. If Full, the JsCmd defines the contents of a try/catch block wrapping a set of comet updates. If Empty, the try catch block is omitted entirely.

By default, it should be set to Full(JE.Call("liftComet.lift_cometError", JE.JsVar("e")).cmd) in development mode and Empty otherwise.

Shadowfiend added some commits Jun 25, 2012

@Shadowfiend Shadowfiend Add cometUpdateExceptionHandler LiftRule.
Not implemented yet, but this rule specifies a Box[JsCmd]. If Full, the
contained JsCmd provides the code to put inside the catch of a try/catch
block that is wrapped around comet updates. If Empty, the old behavior
of not wrapping comet updates in try/catch at all is used.
@Shadowfiend Shadowfiend Properly use LiftRules.cometUpdateExceptionHandler.
CometActor now properly wraps its updates in a try/catch block when
cometUpdateExceptionHandler is Full.
@Shadowfiend Shadowfiend Default cometUpdateExceptionHandler to Empty in production. 391bfa6
@Shadowfiend Shadowfiend Default implementation of liftComet.lift_cometError.
The default implementation tries to log the exception and then rethrows
it. The log is guarded for the existence of console.error and logged as
an error.

fmpwizard commented Jun 26, 2012

Looks great and thanks for the detailed comment on the code.

dpp merged commit bfdffdd into master Jul 1, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment