mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-22 11:46:40 +00:00
[chore]: Bump codeberg.org/gruf/go-errors/v2 from 2.0.2 to 2.1.1 (#1346)
Bumps codeberg.org/gruf/go-errors/v2 from 2.0.2 to 2.1.1. --- updated-dependencies: - dependency-name: codeberg.org/gruf/go-errors/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
d4cddf460a
commit
a6c6bdb34a
2
go.mod
2
go.mod
|
@ -7,7 +7,7 @@ require (
|
||||||
codeberg.org/gruf/go-byteutil v1.0.2
|
codeberg.org/gruf/go-byteutil v1.0.2
|
||||||
codeberg.org/gruf/go-cache/v3 v3.2.2
|
codeberg.org/gruf/go-cache/v3 v3.2.2
|
||||||
codeberg.org/gruf/go-debug v1.2.0
|
codeberg.org/gruf/go-debug v1.2.0
|
||||||
codeberg.org/gruf/go-errors/v2 v2.0.2
|
codeberg.org/gruf/go-errors/v2 v2.1.1
|
||||||
codeberg.org/gruf/go-kv v1.5.2
|
codeberg.org/gruf/go-kv v1.5.2
|
||||||
codeberg.org/gruf/go-logger/v2 v2.2.1
|
codeberg.org/gruf/go-logger/v2 v2.2.1
|
||||||
codeberg.org/gruf/go-mutexes v1.1.5
|
codeberg.org/gruf/go-mutexes v1.1.5
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -54,8 +54,8 @@ codeberg.org/gruf/go-cache/v3 v3.2.2/go.mod h1:+Eje6nCvN8QF71VyYjMWMnkdv6t1kHnCO
|
||||||
codeberg.org/gruf/go-debug v1.2.0 h1:WBbTMnK1ArFKUmgv04aO2JiC/daTOB8zQGi521qb7OU=
|
codeberg.org/gruf/go-debug v1.2.0 h1:WBbTMnK1ArFKUmgv04aO2JiC/daTOB8zQGi521qb7OU=
|
||||||
codeberg.org/gruf/go-debug v1.2.0/go.mod h1:N+vSy9uJBQgpQcJUqjctvqFz7tBHJf+S/PIjLILzpLg=
|
codeberg.org/gruf/go-debug v1.2.0/go.mod h1:N+vSy9uJBQgpQcJUqjctvqFz7tBHJf+S/PIjLILzpLg=
|
||||||
codeberg.org/gruf/go-errors/v2 v2.0.0/go.mod h1:ZRhbdhvgoUA3Yw6e56kd9Ox984RrvbEFC2pOXyHDJP4=
|
codeberg.org/gruf/go-errors/v2 v2.0.0/go.mod h1:ZRhbdhvgoUA3Yw6e56kd9Ox984RrvbEFC2pOXyHDJP4=
|
||||||
codeberg.org/gruf/go-errors/v2 v2.0.2 h1:T9CqfC+ntSIQL5mdQxwHlUMod1htpgNe3P1tugxKlT4=
|
codeberg.org/gruf/go-errors/v2 v2.1.1 h1:oj7JUIvUBafF60HrwN74JrCMol1Ouh3gq1ggrH5hGTw=
|
||||||
codeberg.org/gruf/go-errors/v2 v2.0.2/go.mod h1:6sI75OmvXE2AtRm4WUyGMEyqEOKTsfe+CA+aBXwbtJY=
|
codeberg.org/gruf/go-errors/v2 v2.1.1/go.mod h1:LfzD9nkAAJpEDbkUqOZQ2jdaQ8VrK0pnR36zLOMFq6Y=
|
||||||
codeberg.org/gruf/go-fastcopy v1.1.2 h1:YwmYXPsyOcRBxKEE2+w1bGAZfclHVaPijFsOVOcnNcw=
|
codeberg.org/gruf/go-fastcopy v1.1.2 h1:YwmYXPsyOcRBxKEE2+w1bGAZfclHVaPijFsOVOcnNcw=
|
||||||
codeberg.org/gruf/go-fastcopy v1.1.2/go.mod h1:GDDYR0Cnb3U/AIfGM3983V/L+GN+vuwVMvrmVABo21s=
|
codeberg.org/gruf/go-fastcopy v1.1.2/go.mod h1:GDDYR0Cnb3U/AIfGM3983V/L+GN+vuwVMvrmVABo21s=
|
||||||
codeberg.org/gruf/go-fastpath v1.0.1/go.mod h1:edveE/Kp3Eqi0JJm0lXYdkVrB28cNUkcb/bRGFTPqeI=
|
codeberg.org/gruf/go-fastpath v1.0.1/go.mod h1:edveE/Kp3Eqi0JJm0lXYdkVrB28cNUkcb/bRGFTPqeI=
|
||||||
|
|
34
vendor/codeberg.org/gruf/go-errors/v2/callers.go
generated
vendored
34
vendor/codeberg.org/gruf/go-errors/v2/callers.go
generated
vendored
|
@ -40,33 +40,29 @@ func (f Callers) Frames() []runtime.Frame {
|
||||||
return frames
|
return frames
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON implements json.Marshaler to provide an easy, simply default.
|
// MarshalJSON implements json.Marshaler to provide an easy, simple default.
|
||||||
func (f Callers) MarshalJSON() ([]byte, error) {
|
func (f Callers) MarshalJSON() ([]byte, error) {
|
||||||
// JSON-able frame type
|
// JSON-able frame type
|
||||||
type frame struct {
|
type jsonFrame struct {
|
||||||
Func string `json:"func"`
|
Func string `json:"func"`
|
||||||
File string `json:"file"`
|
File string `json:"file"`
|
||||||
Line int `json:"line"`
|
Line int `json:"line"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate expected frames slice
|
// Convert to frames
|
||||||
frames := make([]frame, 0, len(f))
|
frames := f.Frames()
|
||||||
|
|
||||||
// Get frames iterator for PCs
|
// Allocate expected size jsonFrame slice
|
||||||
iter := runtime.CallersFrames(f)
|
jsonFrames := make([]jsonFrame, 0, len(f))
|
||||||
|
|
||||||
for {
|
for i := 0; i < len(frames); i++ {
|
||||||
// Get next frame
|
frame := frames[i]
|
||||||
f, ok := iter.Next()
|
|
||||||
if !ok {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
// Append to frames slice
|
// Convert each to jsonFrame object
|
||||||
frames = append(frames, frame{
|
jsonFrames = append(jsonFrames, jsonFrame{
|
||||||
Func: funcname(f.Function),
|
Func: funcname(frame.Function),
|
||||||
File: f.File,
|
File: frame.File,
|
||||||
Line: f.Line,
|
Line: frame.Line,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,8 +82,8 @@ func (f Callers) String() string {
|
||||||
frame := frames[i]
|
frame := frames[i]
|
||||||
|
|
||||||
// Append formatted caller info
|
// Append formatted caller info
|
||||||
funcname := funcname(frame.Function)
|
fn := funcname(frame.Function)
|
||||||
buf = append(buf, funcname+"()\n\t"+frame.File+":"...)
|
buf = append(buf, fn+"()\n\t"+frame.File+":"...)
|
||||||
buf = strconv.AppendInt(buf, int64(frame.Line), 10)
|
buf = strconv.AppendInt(buf, int64(frame.Line), 10)
|
||||||
buf = append(buf, '\n')
|
buf = append(buf, '\n')
|
||||||
}
|
}
|
||||||
|
|
12
vendor/codeberg.org/gruf/go-errors/v2/errors.go
generated
vendored
12
vendor/codeberg.org/gruf/go-errors/v2/errors.go
generated
vendored
|
@ -24,13 +24,13 @@ func Wrapf(err error, msgf string, args ...interface{}) error {
|
||||||
return create(fmt.Sprintf(msgf, args...), err)
|
return create(fmt.Sprintf(msgf, args...), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stacktrace fetches a stored stacktrace of callers from an error, or returns nil.
|
// Stacktrace fetches first stored stacktrace of callers from error chain.
|
||||||
func Stacktrace(err error) Callers {
|
func Stacktrace(err error) Callers {
|
||||||
var callers Callers
|
var e interface {
|
||||||
if err, ok := err.(interface { //nolint
|
|
||||||
Stacktrace() Callers
|
Stacktrace() Callers
|
||||||
}); ok {
|
|
||||||
callers = err.Stacktrace()
|
|
||||||
}
|
}
|
||||||
return callers
|
if !As(err, &e) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return e.Stacktrace()
|
||||||
}
|
}
|
||||||
|
|
54
vendor/codeberg.org/gruf/go-errors/v2/standard.go
generated
vendored
54
vendor/codeberg.org/gruf/go-errors/v2/standard.go
generated
vendored
|
@ -3,6 +3,7 @@
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
_ "unsafe"
|
||||||
|
|
||||||
"codeberg.org/gruf/go-bitutil"
|
"codeberg.org/gruf/go-bitutil"
|
||||||
)
|
)
|
||||||
|
@ -18,7 +19,7 @@
|
||||||
func Is(err error, targets ...error) bool {
|
func Is(err error, targets ...error) bool {
|
||||||
var flags bitutil.Flags64
|
var flags bitutil.Flags64
|
||||||
|
|
||||||
// Flags only has 64 bit slots
|
// Flags only has 64 bit-slots
|
||||||
if len(targets) > 64 {
|
if len(targets) > 64 {
|
||||||
panic("too many targets")
|
panic("too many targets")
|
||||||
}
|
}
|
||||||
|
@ -46,26 +47,30 @@ func Is(err error, targets ...error) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
for err != nil {
|
for err != nil {
|
||||||
var errorIs func(error) bool
|
|
||||||
|
|
||||||
// Check if this layer supports .Is interface
|
// Check if this layer supports .Is interface
|
||||||
is, ok := err.(interface{ Is(error) bool })
|
is, ok := err.(interface{ Is(error) bool })
|
||||||
if ok {
|
|
||||||
errorIs = is.Is
|
|
||||||
} else {
|
|
||||||
errorIs = neveris
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := 0; i < len(targets); i++ {
|
if !ok {
|
||||||
// Try directly compare errors
|
// Error does not support interface
|
||||||
if flags.Get(uint8(i)) &&
|
//
|
||||||
err == targets[i] {
|
// Only try perform direct compare
|
||||||
return true
|
for i := 0; i < len(targets); i++ {
|
||||||
|
// Try directly compare errors
|
||||||
|
if flags.Get(uint8(i)) &&
|
||||||
|
err == targets[i] {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
// Try use .Is() interface
|
// Error supports the .Is interface
|
||||||
if errorIs(targets[i]) {
|
//
|
||||||
return true
|
// Perform direct compare AND .Is()
|
||||||
|
for i := 0; i < len(targets); i++ {
|
||||||
|
if (flags.Get(uint8(i)) &&
|
||||||
|
err == targets[i]) ||
|
||||||
|
is.Is(targets[i]) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,15 +97,12 @@ func Is(err error, targets ...error) bool {
|
||||||
//
|
//
|
||||||
// As panics if target is not a non-nil pointer to either a type that implements
|
// As panics if target is not a non-nil pointer to either a type that implements
|
||||||
// error, or to any interface type.
|
// error, or to any interface type.
|
||||||
func As(err error, target interface{}) bool {
|
//
|
||||||
return errors.As(err, target)
|
//go:linkname As errors.As
|
||||||
}
|
func As(err error, target interface{}) bool
|
||||||
|
|
||||||
// Unwrap returns the result of calling the Unwrap method on err, if err's
|
// Unwrap returns the result of calling the Unwrap method on err, if err's
|
||||||
// type contains an Unwrap method returning error. Otherwise, Unwrap returns nil.
|
// type contains an Unwrap method returning error. Otherwise, Unwrap returns nil.
|
||||||
func Unwrap(err error) error {
|
//
|
||||||
return errors.Unwrap(err)
|
//go:linkname Unwrap errors.Unwrap
|
||||||
}
|
func Unwrap(err error) error
|
||||||
|
|
||||||
// neveris fits the .Is(error) bool interface function always returning false.
|
|
||||||
func neveris(error) bool { return false }
|
|
||||||
|
|
54
vendor/codeberg.org/gruf/go-errors/v2/value.go
generated
vendored
Normal file
54
vendor/codeberg.org/gruf/go-errors/v2/value.go
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
package errors
|
||||||
|
|
||||||
|
// WithValue wraps err to store given key-value pair, accessible via Value() function.
|
||||||
|
func WithValue(err error, key any, value any) error {
|
||||||
|
if err == nil {
|
||||||
|
panic("nil error")
|
||||||
|
}
|
||||||
|
return &errWithValue{
|
||||||
|
err: err,
|
||||||
|
key: key,
|
||||||
|
val: value,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Value searches for value stored under given key in error chain.
|
||||||
|
func Value(err error, key any) any {
|
||||||
|
var e *errWithValue
|
||||||
|
|
||||||
|
if !As(err, &e) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.Value(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
type errWithValue struct {
|
||||||
|
err error
|
||||||
|
key any
|
||||||
|
val any
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *errWithValue) Error() string {
|
||||||
|
return e.err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *errWithValue) Is(target error) bool {
|
||||||
|
return e.err == target
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *errWithValue) Unwrap() error {
|
||||||
|
return Unwrap(e.err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *errWithValue) Value(key any) any {
|
||||||
|
for {
|
||||||
|
if key == e.key {
|
||||||
|
return e.val
|
||||||
|
}
|
||||||
|
|
||||||
|
if !As(e.err, &e) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
|
@ -21,8 +21,8 @@ codeberg.org/gruf/go-cache/v3/ttl
|
||||||
# codeberg.org/gruf/go-debug v1.2.0
|
# codeberg.org/gruf/go-debug v1.2.0
|
||||||
## explicit; go 1.16
|
## explicit; go 1.16
|
||||||
codeberg.org/gruf/go-debug
|
codeberg.org/gruf/go-debug
|
||||||
# codeberg.org/gruf/go-errors/v2 v2.0.2
|
# codeberg.org/gruf/go-errors/v2 v2.1.1
|
||||||
## explicit; go 1.16
|
## explicit; go 1.19
|
||||||
codeberg.org/gruf/go-errors/v2
|
codeberg.org/gruf/go-errors/v2
|
||||||
# codeberg.org/gruf/go-fastcopy v1.1.2
|
# codeberg.org/gruf/go-fastcopy v1.1.2
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
|
|
Loading…
Reference in a new issue