2020-12-30 13:18:43 +08:00
|
|
|
// Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
|
2019-06-29 18:17:33 +08:00
|
|
|
//
|
|
|
|
|
// This Source Code Form is subject to the terms of the MIT License.
|
|
|
|
|
// If a copy of the MIT was not distributed with this file,
|
|
|
|
|
// You can obtain one at https://github.com/gogf/gf.
|
|
|
|
|
|
2022-07-15 10:49:04 +08:00
|
|
|
// Package gerror provides rich functionalities to manipulate errors.
|
2020-04-28 15:04:07 +08:00
|
|
|
//
|
2022-07-15 10:49:04 +08:00
|
|
|
// For maintainers, please very note that,
|
|
|
|
|
// this package is quite a basic package, which SHOULD NOT import extra packages
|
2021-11-16 00:26:10 +08:00
|
|
|
// except standard packages and internal packages, to avoid cycle imports.
|
2019-06-29 18:17:33 +08:00
|
|
|
package gerror
|
|
|
|
|
|
|
|
|
|
import (
|
2021-10-11 21:41:56 +08:00
|
|
|
"github.com/gogf/gf/v2/errors/gcode"
|
2019-06-29 18:17:33 +08:00
|
|
|
)
|
|
|
|
|
|
2022-07-15 10:49:04 +08:00
|
|
|
// IEqual is the interface for Equal feature.
|
|
|
|
|
type IEqual interface {
|
|
|
|
|
Error() string
|
|
|
|
|
Equal(target error) bool
|
2020-10-17 17:17:10 +08:00
|
|
|
}
|
|
|
|
|
|
2022-07-15 10:49:04 +08:00
|
|
|
// ICode is the interface for Code feature.
|
|
|
|
|
type ICode interface {
|
|
|
|
|
Error() string
|
|
|
|
|
Code() gcode.Code
|
2020-10-17 17:17:10 +08:00
|
|
|
}
|
2021-09-17 19:26:56 +08:00
|
|
|
|
2022-07-15 10:49:04 +08:00
|
|
|
// IStack is the interface for Stack feature.
|
|
|
|
|
type IStack interface {
|
|
|
|
|
Error() string
|
|
|
|
|
Stack() string
|
2022-04-12 15:45:26 +08:00
|
|
|
}
|
|
|
|
|
|
2022-07-15 10:49:04 +08:00
|
|
|
// ICause is the interface for Cause feature.
|
|
|
|
|
type ICause interface {
|
|
|
|
|
Error() string
|
|
|
|
|
Cause() error
|
2021-09-17 19:26:56 +08:00
|
|
|
}
|
2022-04-12 15:45:26 +08:00
|
|
|
|
2022-07-15 10:49:04 +08:00
|
|
|
// ICurrent is the interface for Current feature.
|
|
|
|
|
type ICurrent interface {
|
|
|
|
|
Error() string
|
|
|
|
|
Current() error
|
2022-04-12 15:45:26 +08:00
|
|
|
}
|
|
|
|
|
|
2022-07-15 10:49:04 +08:00
|
|
|
// IUnwrap is the interface for Unwrap feature.
|
|
|
|
|
type IUnwrap interface {
|
|
|
|
|
Error() string
|
|
|
|
|
Unwrap() error
|
2022-04-12 15:45:26 +08:00
|
|
|
}
|
2022-09-27 10:11:33 +08:00
|
|
|
|
|
|
|
|
const (
|
2022-11-01 20:12:21 +08:00
|
|
|
// commaSeparatorSpace is the comma separator with space.
|
|
|
|
|
commaSeparatorSpace = ", "
|
2022-09-27 10:11:33 +08:00
|
|
|
)
|