diff --git a/doc.go b/doc.go index d32fe62..6df8d30 100644 --- a/doc.go +++ b/doc.go @@ -157,7 +157,11 @@ that has a slice in it is not okay. Fallible injectors -Fallible injectors are injectors that return a value of type TerminalError. +Fallible injectors are special injectors that change the behavior of the injection +chain if they return error. Fallible injectors in the RUN set, that return error +will terminate execution of the injection chain. + +A non-wrapper function that returns nject.TerminalError is a fallible injector. func(input value(s)) (output values(s), TerminalError) diff --git a/types.go b/types.go index ffe6c74..36d98ff 100644 --- a/types.go +++ b/types.go @@ -19,11 +19,8 @@ import ( // and (like other return values) it must be consumed by an upstream handler // or the invoke function. // -// Functions that return TerminalError do not count as having no outputs and -// thus they are not treated as specially required. The when TerminalError is -// returned, if it is nil, then it provides a nil error to the rest of the -// downard chain. If it returns non-nil, then it provides a non-nil error as a -// returned value to the upwards chain. +// Functions that return TerminalError do count as having no outputs and +// thus they are treated as specially required if they're in the RUN set. // // Note: wrapper functions should not return TerminalError because such // a return value would not be automatically converted into a regular error.