Fallback to dispatch an exceptional situation.
This status is acceptable?
Request with an error inside.
Fallback with a fixed response.
Fallback on status code that equals to the provided value.
Fake implementation, for unit tests mostly.
Exception handing in the framework is very simple and very
intuitive. All you need to do is to wrap your "take" into
TkFallback decorator and create
a fallback that dispatches exceptions, for example:
Take take = new TkFallback( original_take, new FbChain( new FbOnStatus(404, new TkHTML("page not found")), new FbOnStatus(405, new TkHTML("this method not allowed")), new FbFixed(new RsText("oops, some big problem")) ) );
If and when exception occurs,
will catch it and create an instance of
RqFallback. This object will
be sent to the encapsulated instance of
Fallback. It is recommended to use
FbChain to dispatch a request
through a series of fallbacks. The first of them who will return
some response will stop the chain.
Copyright © 2015 Take. All rights reserved.