Interface | Description |
---|---|
Fallback |
Fallback to dispatch an exceptional situation.
|
FbStatus.Check |
This status is acceptable?
|
RqFallback |
Request with an error inside.
|
Class | Description |
---|---|
FbChain |
Fallback chain.
|
FbEmpty |
Empty fallback.
|
FbFixed |
Fallback with a fixed response.
|
FbStatus |
Fallback on status code that equals to the provided value.
|
FbWrap |
Fallback wrap.
|
RqFallback.Fake |
Fake implementation, for unit tests mostly.
|
TkFallback |
Fallback.
|
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, TkFallback
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.