Skip to content

Commit

Permalink
Change quoting in error message (use %q)
Browse files Browse the repository at this point in the history
  • Loading branch information
asmaloney committed Aug 5, 2023
1 parent 7108c84 commit f601073
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions amod/amod.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,11 @@ func setModuleParams(module modules.Interface, log *issueLog, fields []*field) {
case errors.As(err, &keyvalue.ErrInvalidType{}) ||
errors.As(err, &modules.ErrInvalidValue{}) ||
errors.As(err, &modules.ErrValueOutOfRange{}):
log.errorTR(value.Tokens, 1, 1, "%s '%s' %v", moduleName, field.Key, err)
log.errorTR(value.Tokens, 1, 1, "%s %q %v", moduleName, field.Key, err)
continue

default:
log.errorT(field.Tokens, "INTERNAL: unhandled error (%v) in %s config: '%s'", err, moduleName, field.Key)
log.errorT(field.Tokens, "INTERNAL: unhandled error (%v) in %s config: %q", err, moduleName, field.Key)
continue
}
}
Expand Down
8 changes: 4 additions & 4 deletions amod/amod_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func Example_imaginalFieldType() {
~~ productions ~~`)

// Output:
// ERROR: imaginal 'delay' must be a number (line 6, col 20)
// ERROR: imaginal "delay" must be a number (line 6, col 20)
}

func Example_imaginalFieldRange() {
Expand All @@ -263,7 +263,7 @@ func Example_imaginalFieldRange() {
~~ productions ~~`)

// Output:
// ERROR: imaginal 'delay' is out of range (minimum 0) (line 6, col 20)
// ERROR: imaginal "delay" is out of range (minimum 0) (line 6, col 20)
}

func Example_imaginalFieldUnrecognized() {
Expand Down Expand Up @@ -308,7 +308,7 @@ func Example_memoryDecayOutOfRange() {
~~ productions ~~`)

// Output:
// ERROR: memory 'decay' is out of range (0-1) (line 6, col 18)
// ERROR: memory "decay" is out of range (0-1) (line 6, col 18)
}

func Example_memoryDecayOutOfRange2() {
Expand All @@ -323,7 +323,7 @@ func Example_memoryDecayOutOfRange2() {
~~ productions ~~`)

// Output:
// ERROR: memory 'decay' is out of range (0-1) (line 6, col 18)
// ERROR: memory "decay" is out of range (0-1) (line 6, col 18)
}

func Example_proceduralFieldUnrecognized() {
Expand Down

0 comments on commit f601073

Please sign in to comment.