def checkValueError(f): f.trap(ValueError) return "foo" def getFoo(): return getResult().addErrback( checkValueError).addCallback( process)