Last modified: 2014-10-13 14:28:40 UTC
When a json for action=wbeditentity contains a snak, but that snak has no datavalue key the following error is given: {code=internal_api_error_InvalidArgumentException, info=Exception Caught: Wikibase\SnakObject::newFromType got an array with to few constructor arguments} The validation of the json should give a better error here to see the cause of the exception, instead of looking at the source.
Could you provide some params that when passed to the api reproduce this?
Be creative: {"claims":[{"type":"statement","mainsnak":{"snaktype":"value","property":"P1"},"rank":"normal"}]} for an existing item. Only remove the datavalue from the input. There are maybe more possible combination, all should result in a proper error message and not in an api internal error. Maybe along to ::newFromType a ::isValidInput/::canCreateTypeFromInput or so is needed to do this, which calls internal the same stack than the type would do. When catching the internal error there is no way to know the missing json key, which would be a nice information for the client.