remove errors.Format

This commit is contained in:
Darien Raymond
2017-04-09 00:31:06 +02:00
parent 6c736b8d57
commit bc4e2293ef
4 changed files with 5 additions and 22 deletions
+1 -18
View File
@@ -2,7 +2,6 @@
package errors
import (
"fmt"
"strings"
"v2ray.com/core/common/serial"
@@ -28,23 +27,15 @@ type hasSeverity interface {
// Error is an error object with underlying error.
type Error struct {
format string
message []interface{}
inner error
severity Severity
path []string
}
func (v *Error) formMessage() string {
if len(v.format) == 0 {
return serial.Concat(v.message...)
}
return fmt.Sprintf(v.format, v.message...)
}
// Error implements error.Error().
func (v *Error) Error() string {
msg := v.formMessage()
msg := serial.Concat(v.message...)
if v.inner != nil {
msg += " > " + v.inner.Error()
}
@@ -116,14 +107,6 @@ func New(msg ...interface{}) *Error {
}
}
func Format(format string, values ...interface{}) *Error {
return &Error{
format: format,
message: values,
severity: SeverityInfo,
}
}
// Cause returns the root cause of this error.
func Cause(err error) error {
if err == nil {