오류 처리
여러 오류가 발생하면 첫 번째 오류만 반환됩니다. errors.go를 방문하여 발생할 수 있는 모든 오류를 확인하세요
go
c1 := carbon.Parse("xxx")
if c1.HasError() {
// 오류 처리...
log.Fatal(c1.Error)
}
// 출력
failed to parse "xxx" as carbon
c2 := carbon.Parse("2020-08-05").SetTimezone("xxx")
if c2.HasError() {
// 오류 처리...
log.Fatal(c2.Error)
}
// 출력
invalid timezone "xxx", please see the file "$GOROOT/lib/time/zoneinfo.zip" for all valid timezones
c3 := carbon.Parse("xxx").SetTimezone("xxx")
if c3.HasError() {
// 오류 처리...
log.Fatal(c3.Error)
}
// 출력
failed to parse "xxx" as carbon