diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-10 21:54:49 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-10 21:54:49 -0700 |
commit | c604347f1950e3dfbef2f524da8a63692848da27 (patch) | |
tree | 0ec8a2d602eb234a37c0d39906e4c645e6b8bac8 /encode_string.go | |
parent | cf8f8527e968c448995bdcaaad9c4351d3a2ab3f (diff) | |
parent | 49415d88cdd0eed102627369bfdf9de78d0e8bed (diff) |
Merge branch 'lukeshu/panic'
Diffstat (limited to 'encode_string.go')
-rw-r--r-- | encode_string.go | 3 |
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[:]) |