Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Mzack9999 committed Aug 19, 2023
1 parent 4bde0f5 commit a494c91
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -936,24 +936,24 @@ func init() {
return nil, errors.NewWithErr(err).Msgf("invalid start position")
}
if start > len(argStr) {
return nil, errors.NewWithErr(err).Msgf("start position bigger than slice length")
return nil, errors.New("start position bigger than slice length")
}
if len(args) == 2 {
return argStr[start:], nil
}

end, err := strconv.Atoi(toString(args[2]))
if err != nil {
return nil, errors.NewWithErr(err).Msgf("invalid end position")
return nil, errors.New("invalid end position")
}
if end < 0 {
return nil, errors.NewWithErr(err).Msgf("negative end position")
return nil, errors.New("negative end position")
}
if end < start {
return nil, errors.NewWithErr(err).Msgf("end position before start")
return nil, errors.New("end position before start")
}
if end > len(argStr) {
return nil, errors.NewWithErr(err).Msgf("end position bigger than slice length start")
return nil, errors.New("end position bigger than slice length start")
}
return argStr[start:end], nil
}))
Expand Down

0 comments on commit a494c91

Please sign in to comment.