summaryrefslogtreecommitdiff
path: root/encode_string.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-01-27 01:24:02 -0700
committerLuke Shumaker <lukeshu@lukeshu.com>2023-02-10 21:54:37 -0700
commit49415d88cdd0eed102627369bfdf9de78d0e8bed (patch)
tree0ec8a2d602eb234a37c0d39906e4c645e6b8bac8 /encode_string.go
parentcf8f8527e968c448995bdcaaad9c4351d3a2ab3f (diff)
tree-wide: Audit panic error messages
These shouldn't happen, but if they do, then let's make it easier to debug.
Diffstat (limited to 'encode_string.go')
-rw-r--r--encode_string.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/encode_string.go b/encode_string.go
index 328b07a..208aef4 100644
--- a/encode_string.go
+++ b/encode_string.go
@@ -5,6 +5,7 @@
package lowmemjson
import (
+ "fmt"
"io"
"unicode/utf8"
@@ -40,7 +41,7 @@ func writeStringShortEscape(w io.Writer, c rune) (int, error) {
case '\t':
b = 't'
default:
- panic("should not happen")
+ panic(fmt.Errorf("should not happen: writeStringShortEscape called with invalid rune: %q", c))
}
buf := [2]byte{'\\', b}
return w.Write(buf[:])