Skip to content

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Oct 29, 2015

@jmikola jmikola changed the title [WIP] to/fromJSON exceptions PHPC-475: toJSON and fromJSON should throw on error Oct 30, 2015
OK: Got MongoDB\Driver\Exception\UnexpectedValueException
lexical error: invalid string in json text.
foo
(right here) ------^
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it really add the "right here" stuff? :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, yes. It comes directly from yajl. We can attempt to shorten this to a one-liner at a later point.

@derickr
Copy link
Contributor

derickr commented Oct 30, 2015

LGTM

@jmikola jmikola merged commit 920e836 into mongodb:master Oct 30, 2015
jmikola added a commit that referenced this pull request Oct 30, 2015
@jmikola jmikola deleted the test-json branch October 30, 2015 14:56
}

if (bson_reader_read(reader, &eof) || !eof) {
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "Reading document did not exhaust input buffer");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will yield in two exceptions being thrown because the former has no "return"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants