Closed h4ckm03d closed 10 years ago
Why using panic instead of return error? because it will break all application if MustParse function got error.
MustParse
func MustParse(cronLine string) *Expression { expr, err := Parse(cronLine) if err != nil { panic(err) } return expr }
CMIIW, I prefer like this.
func MustParse(cronLine string) (*Expression, error) { expr, err := Parse(cronLine) if err != nil { return nil, err } return expr,nil }
Use func Parse(cronLine string) (*Expression, error) if you prefer this form.
func Parse(cronLine string) (*Expression, error)
Why using panic instead of return error? because it will break all application if
MustParse
function got error.CMIIW, I prefer like this.