Content-Length: 247432 | pFad | http://github.com/projectdiscovery/dsl/commit/de9bd3c7089101d0ca3406bd6a993caf14cc1ad0

40 propogate err with ErrParsingErr · projectdiscovery/dsl@de9bd3c · GitHub
Skip to content

Commit

Permalink
propogate err with ErrParsingErr
Browse files Browse the repository at this point in the history
  • Loading branch information
tarunKoyalwar committed Jul 28, 2023
1 parent 238e83e commit de9bd3c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions dsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ import (
"github.com/hashicorp/go-version"
"github.com/kataras/jwt"
"github.com/logrusorgru/aurora"
"github.com/pkg/errors"
"github.com/projectdiscovery/dsl/deserialization"
"github.com/projectdiscovery/dsl/llm"
"github.com/projectdiscovery/dsl/randomip"
"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/mapcidr"
jarm "github.com/projectdiscovery/utils/crypto/jarm"
errors "github.com/projectdiscovery/utils/errors"
maputils "github.com/projectdiscovery/utils/maps"
randint "github.com/projectdiscovery/utils/rand"
stringsutil "github.com/projectdiscovery/utils/strings"
Expand Down Expand Up @@ -775,7 +775,7 @@ func init() {

firstParsed, parseErr := version.NewVersion(toString(args[0]))
if parseErr != nil {
return nil, ErrParsingArg
return nil, errors.NewWithErr(ErrParsingArg).Wrap(parseErr)
}

var versionConstraints []string
Expand Down Expand Up @@ -846,27 +846,27 @@ func init() {
}
start, err := strconv.Atoi(toString(args[1]))
if err != nil {
return nil, errors.Wrap(err, "invalid start position")
return nil, errors.NewWithErr(err).Msgf("invalid start position")
}
if start > len(argStr) {
return nil, errors.Wrap(err, "start position bigger than slice length")
return nil, errors.NewWithErr(err).Msgf("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.Wrap(err, "invalid end position")
return nil, errors.NewWithErr(err).Msgf("invalid end position")
}
if end < 0 {
return nil, errors.Wrap(err, "negative end position")
return nil, errors.NewWithErr(err).Msgf("negative end position")
}
if end < start {
return nil, errors.Wrap(err, "end position before start")
return nil, errors.NewWithErr(err).Msgf("end position before start")
}
if end > len(argStr) {
return nil, errors.Wrap(err, "end position bigger than slice length start")
return nil, errors.NewWithErr(err).Msgf("end position bigger than slice length start")
}
return argStr[start:end], nil
}))
Expand Down

0 comments on commit de9bd3c

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/projectdiscovery/dsl/commit/de9bd3c7089101d0ca3406bd6a993caf14cc1ad0

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy