Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Invalid type map class throws InvalidArgumentException #25

Merged
merged 1 commit into from
Jul 28, 2015

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Jul 27, 2015

No description provided.

@jmikola
Copy link
Member Author

jmikola commented Jul 28, 2015

FYI: I'm not using the exception messages in this spec. Let me know if you'd like me to update the test cases to what we have in mongodb/mongo-php-driver#64:

  • "Class %s does not exist"
  • "Class %s is not instantiatable"
  • "Class %s does not implement %s\Unserializable"
  • "Expected bsonSerialize() to return an array or stdClass, %s given" (where %s is the class name or non-object's PHP type)

@derickr
Copy link
Contributor

derickr commented Jul 28, 2015

I'm not using the exception messages from the spec either :-)

I don't quite see why you need all of these though? For the first three, I just use "The typemap does not provide a class that implements MongoDB\BSON\Unserializable". I don't actually validate when parsing the typemap. Why is that needed?

@derickr derickr merged commit bf98158 into master Jul 28, 2015
@jmikola
Copy link
Member Author

jmikola commented Jul 28, 2015

I figured that the extra messages would help users catch their problem. Putting in the class name in the exception message helps, too.

API-wise, I think throwing an InvalidArgumentException is enough, though, since we're not using codes.

@jmikola jmikola deleted the jmikola-patch-1 branch July 28, 2015 13:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants