update go samples

This commit is contained in:
William Cheng
2024-05-01 22:52:26 +08:00
parent 9f57684dad
commit d573f00e84

View File

@@ -23,7 +23,8 @@ var (
// ParsingError indicates that an error has occurred when parsing request parameters
type ParsingError struct {
Err error
Param string
Err error
}
func (e *ParsingError) Unwrap() error {
@@ -31,7 +32,11 @@ func (e *ParsingError) Unwrap() error {
}
func (e *ParsingError) Error() string {
return e.Err.Error()
if e.Param == "" {
return e.Err.Error()
} else {
return e.Param + ": " + e.Err.Error()
}
}
// RequiredError indicates that an error has occurred when parsing request parameters