1
0
mirror of https://github.com/nitezs/sub2sing-box.git synced 2024-12-23 15:14:43 -05:00
sub2sing-box/parser/error.go

23 lines
458 B
Go
Raw Normal View History

2024-03-22 04:10:15 -04:00
package parser
type ParseError struct {
Type ParseErrorType
Message string
Raw string
}
type ParseErrorType string
const (
2024-08-05 03:01:05 -04:00
ErrInvalidPrefix ParseErrorType = "invalid url prefix"
ErrInvalidStruct ParseErrorType = "invalid struct"
ErrInvalidPort ParseErrorType = "invalid port number"
2024-03-22 04:10:15 -04:00
)
func (e *ParseError) Error() string {
if e.Message != "" {
return string(e.Type) + ": " + e.Message + " \"" + e.Raw + "\""
}
return string(e.Type)
}