Skip to content

Commit

Permalink
Add logging for malformed arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
mpchadwick committed Nov 4, 2020
1 parent 1fdb725 commit 2e2abc1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (p Provider) raw (s string) string {
argsStart := strings.Index(parts[2], "(")
argsEnd := strings.Index(parts[2], ")")
if argsStart == -1 || argsEnd == -1 || argsEnd < argsStart {
// TODO: Cover this with logging
logger.Error("Could not identify arguments for " + parts[2])
return ""
}

Expand Down
6 changes: 3 additions & 3 deletions src/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ func TestGet(t *testing.T) {
t.Errorf("Unsupported method not handled correctly")
}

r7 := provider.Get("faker.Internet().Slug")
if r7 != "" {
t.Errorf("Got a value and was expecting empty string")
_ = provider.Get("faker.Internet().Slug")
if hook.LastEntry().Message != "Could not identify arguments for Slug" {
t.Errorf("Malformed arguments not handled correctly")
}
}

0 comments on commit 2e2abc1

Please sign in to comment.