-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get rid of modifiers in the
clierror
package (#2092)
* implement own clierror interface * get rid of modifiers
- Loading branch information
Showing
28 changed files
with
278 additions
and
250 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
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
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,14 @@ | ||
package clierror | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
// Check prints error and executes os.Exit(1) if the error is not nil | ||
func Check(err Error) { | ||
if err != nil { | ||
fmt.Println(err.String()) | ||
os.Exit(1) | ||
} | ||
} |
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 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,9 +1,13 @@ | ||
package clierror | ||
|
||
func Wrap(inside error, modifiers ...modifier) error { | ||
if err, ok := inside.(*clierror); ok { | ||
return err.wrap(New(modifiers...)) | ||
} | ||
import "fmt" | ||
|
||
return New(Message(inside.Error())).wrap(New(modifiers...)) | ||
// Wrap allows to cover and error with additional information | ||
func Wrap(inside error, outside Error) Error { | ||
return WrapE(new(fmt.Sprintf("%v", inside)), outside) | ||
} | ||
|
||
// WrapE allows to cover clierror with additional information | ||
func WrapE(inside, outside Error) Error { | ||
return inside.(*clierror).wrap(outside.(*clierror)) | ||
} |
Oops, something went wrong.