Documentation
¶
Index ¶
Constants ¶
View Source
const ( //ReturnNil is build in fallback name ReturnNil = "returnnull" //ReturnErr is build in fallback name ReturnErr = "throwexception" )
Variables ¶
View Source
var ErrFallbackNotExists = errors.New("fallback func does not exist")
ErrFallbackNotExists happens if fallback implementation does not exist
Functions ¶
func FallbackErr ¶
func FallbackErr(inv *invocation.Invocation, finish chan *invocation.Response) func(error) error
FallbackErr set err in response
func FallbackNil ¶
func FallbackNil(inv *invocation.Invocation, finish chan *invocation.Response) func(error) error
FallbackNil return empty response
func RegisterFallback ¶
RegisterFallback register custom logic
Types ¶
type Fallback ¶
type Fallback func(inv *invocation.Invocation, finish chan *invocation.Response) func(error) error
Fallback defines how to return response if remote call fails. a implementation should return a closure to handle the error. in this closure, if you fallback logic should handle the original error, you can return a fallback error to replace the original error you can assemble invocation.Response on demand in summary the closure defines, "if err happens, how to handle it".
Click to show internal directories.
Click to hide internal directories.