You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
teach strconv.UnquoteChar to return io.ErrUnexpectedError instead of strconv.ErrSyntax when it sees truncated but otherwise valid input.
This is needed to get proper error reporting in situations where UnquoteChar is used to decode input stream step by step: there if we see truncated version of valid character as input always returning ErrSyntax effectively blocks caller from determining what it was - a real syntax error or unexpected end of stream.
Since UnquoteChar is internally used by Unquote, but Unquote always operates on complete input, Unquote error behaviour should be preserved to return ErrSyntax in all cases.
I propose to make the following change:
teach strconv.UnquoteChar to return io.ErrUnexpectedError instead of strconv.ErrSyntax when it sees truncated but otherwise valid input.
This is needed to get proper error reporting in situations where UnquoteChar is used to decode input stream step by step: there if we see truncated version of valid character as input always returning ErrSyntax effectively blocks caller from determining what it was - a real syntax error or unexpected end of stream.
Since UnquoteChar is internally used by Unquote, but Unquote always operates on complete input, Unquote error behaviour should be preserved to return ErrSyntax in all cases.
CL which implements this change: https://go-review.googlesource.com/37052/
/cc @rsc, @robpike, @Sajmani, @minux
The text was updated successfully, but these errors were encountered: