2021-07-23 11:00:20 +08:00
|
|
|
package carbon
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
// 无效的时区错误
|
|
|
|
var invalidTimezoneError = func(timezone string) error {
|
2021-07-24 01:04:11 +08:00
|
|
|
return fmt.Errorf("invalid timezone %q, please see the file %q for all valid timezones", timezone, "$GOROOT/lib/time/zoneinfo.zip")
|
2021-07-23 11:00:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 无效的持续时长错误
|
|
|
|
var invalidDurationError = func(duration string) error {
|
2021-07-24 01:04:11 +08:00
|
|
|
return fmt.Errorf("invalid duration %q, please make sure the duration is valid", duration)
|
2021-07-23 11:00:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 无效的时间字符串错误
|
|
|
|
var invalidValueError = func(value string) error {
|
2021-08-06 20:00:22 +08:00
|
|
|
return fmt.Errorf("cannot parse %q as carbon, please make sure the value is valid", value)
|
2021-07-23 11:00:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 无效的布局模板错误
|
|
|
|
var invalidLayoutError = func(value, layout string) error {
|
2021-08-06 20:00:22 +08:00
|
|
|
return fmt.Errorf("cannot parse %q as carbon by layout %q, please make sure the value and layout match", value, layout)
|
2021-07-23 11:00:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 无效的格式化字符错误
|
|
|
|
var invalidFormatError = func(value, format string) error {
|
2021-08-06 20:00:22 +08:00
|
|
|
return fmt.Errorf("cannot parse %q as carbon by format %q, please make sure the value and format match", value, format)
|
2021-07-23 11:00:20 +08:00
|
|
|
}
|