1
0
mirror of https://github.com/json-iterator/go.git synced 2025-07-03 23:30:41 +02:00

fix #183 error message not only show expectation, but also the actual value

This commit is contained in:
Tao Wen
2017-10-09 08:24:51 +08:00
parent 5068c8baaf
commit 0149a5cf4a
5 changed files with 18 additions and 18 deletions

View File

@ -19,7 +19,7 @@ func (iter *Iterator) ReadArray() (ret bool) {
case ',':
return true
default:
iter.ReportError("ReadArray", "expect [ or , or ] or n, but found: "+string([]byte{c}))
iter.ReportError("ReadArray", "expect [ or , or ] or n, but found "+string([]byte{c}))
return
}
}
@ -42,7 +42,7 @@ func (iter *Iterator) ReadArrayCB(callback func(*Iterator) bool) (ret bool) {
c = iter.nextToken()
}
if c != ']' {
iter.ReportError("ReadArrayCB", "expect ] in the end")
iter.ReportError("ReadArrayCB", "expect ] in the end, but found " + string([]byte{c}))
return false
}
return true
@ -53,6 +53,6 @@ func (iter *Iterator) ReadArrayCB(callback func(*Iterator) bool) (ret bool) {
iter.skipThreeBytes('u', 'l', 'l')
return true // null
}
iter.ReportError("ReadArrayCB", "expect [ or n, but found: "+string([]byte{c}))
iter.ReportError("ReadArrayCB", "expect [ or n, but found "+string([]byte{c}))
return false
}