mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
Version/v2.6.0 beta (#3183)
This commit is contained in:
@ -16,9 +16,9 @@ type Option struct {
|
||||
Code gcode.Code // Error code if necessary.
|
||||
}
|
||||
|
||||
// NewOption creates and returns a custom error with Option.
|
||||
// NewWithOption creates and returns a custom error with Option.
|
||||
// It is the senior usage for creating error, which is often used internally in framework.
|
||||
func NewOption(option Option) error {
|
||||
func NewWithOption(option Option) error {
|
||||
err := &Error{
|
||||
error: option.Error,
|
||||
text: option.Text,
|
||||
@ -29,3 +29,9 @@ func NewOption(option Option) error {
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// NewOption creates and returns a custom error with Option.
|
||||
// Deprecated: use NewWithOption instead.
|
||||
func NewOption(option Option) error {
|
||||
return NewWithOption(option)
|
||||
}
|
||||
|
||||
@ -442,7 +442,7 @@ func Test_HashCode(t *testing.T) {
|
||||
|
||||
func Test_NewOption(t *testing.T) {
|
||||
gtest.C(t, func(t *gtest.T) {
|
||||
t.AssertNE(gerror.NewOption(gerror.Option{
|
||||
t.AssertNE(gerror.NewWithOption(gerror.Option{
|
||||
Error: errors.New("NewOptionError"),
|
||||
Stack: true,
|
||||
Text: "Text",
|
||||
|
||||
Reference in New Issue
Block a user