mirror of
https://github.com/bestnite/sub2clash.git
synced 2025-06-17 12:43:18 +08:00
refactor
This commit is contained in:
24
error/parse_error.go
Normal file
24
error/parse_error.go
Normal file
@ -0,0 +1,24 @@
|
||||
package error
|
||||
|
||||
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"
|
||||
ErrCannotParseParams ParseErrorType = "cannot parse query parameters"
|
||||
ErrInvalidBase64 ParseErrorType = "invalid base64"
|
||||
)
|
||||
|
||||
func (e *ParseError) Error() string {
|
||||
if e.Message != "" {
|
||||
return string(e.Type) + ": " + e.Message + " \"" + e.Raw + "\""
|
||||
}
|
||||
return string(e.Type)
|
||||
}
|
Reference in New Issue
Block a user