1
0
mirror of https://github.com/bestnite/sub2sing-box.git synced 2026-06-08 16:04:43 +00:00
Files
sub2sing-box/parser/error.go
T

24 lines
572 B
Go
Executable File

package parser
type ParseError struct {
Type ParseErrorType
Message string
Raw string
}
type ParseErrorType string
const (
ErrInvalidPrefix ParseErrorType = "invalid url prefix"
ErrInvalidStruct ParseErrorType = "invalid struct"
ErrInvalidPort ParseErrorType = "invalid port number"
ErrInvalidNetworkBytesCompat ParseErrorType = "invalid network bytes compat"
)
func (e *ParseError) Error() string {
if e.Message != "" {
return string(e.Type) + ": " + e.Message + " \"" + e.Raw + "\""
}
return string(e.Type)
}