error strings should not be capitalized
665 }
666 if len(params) > 1 {
667 if state.offset, err = strconv.ParseInt(params[1], 10, 64); strict && err != nil {
668 return fmt.Errorf("Byterange sub-range offset value parsing error: %s", err)669 }
670 }
671 case !state.tagSCTE35 && strings.HasPrefix(line, "#EXT-SCTE35:"):
error strings should not be capitalized
661 state.offset = 0
662 params := strings.SplitN(line[17:], "@", 2)
663 if state.limit, err = strconv.ParseInt(params[0], 10, 64); strict && err != nil {
664 return fmt.Errorf("Byterange sub-range length value parsing error: %s", err)665 }
666 if len(params) > 1 {
667 if state.offset, err = strconv.ParseInt(params[1], 10, 64); strict && err != nil {
error strings should not be capitalized
644 state.xmap.URI = v
645 case "BYTERANGE":
646 if _, err = fmt.Sscanf(v, "%d@%d", &state.xmap.Limit, &state.xmap.Offset); strict && err != nil {
647 return fmt.Errorf("Byterange sub-range length value parsing error: %s", err)648 }
649 }
650 }
error strings should not be capitalized
610 case "TIME-OFFSET":
611 st, err := strconv.ParseFloat(v, 64)
612 if err != nil {
613 return fmt.Errorf("Invalid TIME-OFFSET: %s: %v", v, err)614 }
615 p.StartTime = st
616 case "PRECISE":
error strings should not be capitalized
485 duration := line[8:sepIndex]
486 if len(duration) > 0 {
487 if state.duration, err = strconv.ParseFloat(duration, 64); strict && err != nil {
488 return fmt.Errorf("Duration parsing error: %s", err)489 }
490 }
491 if len(line) > sepIndex {
error strings should not be capitalized
248 }
249 return media, MEDIA, nil
250 }
251 return nil, state.listType, errors.New("Can't detect playlist type")252}
253
254// DecodeAttributeList turns an attribute list into a key, value map. You should trim
error strings should not be capitalized
195 master = NewMasterPlaylist()
196 media, err = NewMediaPlaylist(8, 1024) // Winsize for VoD will become 0, capacity auto extends
197 if err != nil {
198 return nil, 0, fmt.Errorf("Create media playlist failed: %s", err)199 }
200
201 // If we have custom tags to parse
error strings should not be capitalized
41 } else if v == "NO" {
42 newTag.Jedi = false
43 } else {
44 err = errors.New("Valid strings for JEDI attribute are YES and NO.")45 }
46 }
47 }
error strings should not end with punctuation or newlines
41 } else if v == "NO" {
42 newTag.Jedi = false
43 } else {
44 err = errors.New("Valid strings for JEDI attribute are YES and NO.")45 }
46 }
47 }
Description
Error strings follow a set of guidelines to ensure uniformity and good composability.
Quoting Go Code Review Comments:
Error strings should not be capitalized (unless beginning with
proper nouns or acronyms) or end with punctuation, since they are
usually printed following other context. That is, use
fmt.Errorf("something bad") not fmt.Errorf("Something bad"), so
that log.Printf("Reading %s: %v", filename, err) formats without a
spurious capital letter mid-message.