Brion Vibber schreef:
Roan Kattouw wrote:
Throwing an MWException on invalid input is not very nice. You should really use something like:
Yeah, I was too lazy to investigate how to do it right.
I don't blame you. I know exactly two developers who are able to write sane API code (sane meaning I don't have to revert them or clean up after them). The same is true about other obscure parts of the code such as the parser, of course (I seem to remember an earlier thread about this general subject).
The response isn't examined at all by the caller right now, so I had no rush. ;)
Probably because right now, the only caller is you. That's bound to change when this extension goes live, of course.
Thanks for the tips!
No problem. I appreciate the fact you chose to use an API module for this particular purpose even though you don't know the API very well. Like I said above, your API module is available to callers other than your extension, and should be made suitable for that purpose. You should keep that in mind when deciding which parameters the module takes and what it returns (in practice this means that if you can return a property that your caller doesn't use, but you have some sort of notion that it might be useful in the future or someone else, you should do it).
Roan Kattouw (Catrope)