Skip to content

Commit

Permalink
correct docs for TerminalError (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
muir authored Jan 15, 2023
1 parent 7aef562 commit 9e8e1bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 5 additions & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 2 additions & 5 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9e8e1bc

Please sign in to comment.