-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
57 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The `caller` package defines an interface for managing call stack data. This is useful for logging, error handling, and other applications. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The `errors` package defines interfaces for error types that manage wrapping errors with additional context or data. This allows for troubleshooting and error handling comparable to traditional exception management. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
package error | ||
|
||
// Error defines a robust error stack interface. | ||
type Error interface { | ||
import ( | ||
"github.com/bdlm/std/v2/caller" | ||
) | ||
|
||
// Caller is the interface implemented by error types that can expose | ||
// runtime caller data. | ||
type Caller interface { | ||
// Caller returns the associated Caller instance. | ||
Caller() Caller | ||
Caller() caller.Caller | ||
} | ||
|
||
// Error defines a robust error stack interface. | ||
type Error interface { | ||
// Error implements error. | ||
Error() string | ||
|
||
// Has tests to see if the test error exists anywhere in the error | ||
// stack. | ||
Has(error) bool | ||
|
||
// Is tests to see if the test error matches most recent error in the | ||
// stack. | ||
// Is tests to see if the test error matches any error in the stack via | ||
// equality comparison. | ||
Is(error) bool | ||
|
||
// Unwrap returns the next error, if any. | ||
Unwrap() Error | ||
// Unwrap returns the wrapped error, if any, otherwise nil. | ||
Unwrap() error | ||
} | ||
|
||
// Wrapper is an interface implemented by error types that have wrapped | ||
// a previous error. | ||
type Wrapper interface { | ||
// Unwrap returns the next error in the error stack, if any, otherwise | ||
// nil. | ||
Unwrap() error | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
package importer | ||
|
||
// Importer is the interface that wraps the basic Import method. | ||
// | ||
// Importer accepts the empty interface and extracts data from there, returning | ||
// an error if the import fails. | ||
// | ||
// Implementations must not retain data. Implementations should not retain any | ||
// imported data if returning an error. | ||
// Importer is the interface that wraps the standard Import method. | ||
type Importer interface { | ||
// Import imports the given data into the reciever's data structure. | ||
Import(data interface{}) error | ||
// Import imports the given data into the reciever's data structure. It | ||
// accepts the empty interface and extracts data from there, returning | ||
// an error if the import fails. | ||
// | ||
// Implementations must not retain d. Implementations should not retain | ||
// any imported data if returning an error. | ||
Import(d interface{}) error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters