mirror of
https://github.com/pion/stun.git
synced 2025-10-08 09:10:20 +08:00
all: reduce dependencides and be more idiomatic
This commit is contained in:
15
errors.go
15
errors.go
@@ -1,9 +1,5 @@
|
||||
package stun
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Error is error type for constant errors in stun package.
|
||||
//
|
||||
// See http://dave.cheney.net/2016/04/07/constant-errors for more info.
|
||||
@@ -41,18 +37,15 @@ type DecodeErrPlace struct {
|
||||
}
|
||||
|
||||
func (p DecodeErrPlace) String() string {
|
||||
return fmt.Sprintf("%s/%s", p.Parent, p.Children)
|
||||
return p.Parent + "/" + p.Children
|
||||
}
|
||||
|
||||
func (e DecodeErr) Error() string {
|
||||
return fmt.Sprintf("BadFormat for %s: %s",
|
||||
e.Place,
|
||||
e.Message,
|
||||
)
|
||||
return "BadFormat for " + e.Place.String() + ": " + e.Message
|
||||
}
|
||||
|
||||
func newDecodeErr(parent, children, message string) DecodeErr {
|
||||
return DecodeErr{
|
||||
func newDecodeErr(parent, children, message string) *DecodeErr {
|
||||
return &DecodeErr{
|
||||
Place: DecodeErrPlace{Parent: parent, Children: children},
|
||||
Message: message,
|
||||
}
|
||||
|
Reference in New Issue
Block a user