Refine format

This commit is contained in:
世界 2022-06-16 11:46:32 +08:00
parent 9d88431791
commit 90beb46c6d
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
16 changed files with 74 additions and 143 deletions

View file

@ -3,10 +3,11 @@ package exceptions
import (
"context"
"errors"
"fmt"
"io"
"net"
"os"
F "github.com/sagernet/sing/common/format"
)
type causeError struct {
@ -42,15 +43,15 @@ func (e *extendedError) Unwrap() error {
}
func New(message ...any) error {
return errors.New(fmt.Sprint(message...))
return errors.New(F.ToString(message...))
}
func Cause(cause error, message ...any) error {
return &causeError{fmt.Sprint(message...), cause}
return &causeError{F.ToString(message...), cause}
}
func Extend(cause error, message ...any) error {
return &extendedError{fmt.Sprint(message...), cause}
return &extendedError{F.ToString(message...), cause}
}
type HasInnerError interface {