zachfeldman / rubypress

Ruby interface for the WordPress XMLRPC API. Follows standard XML-RPC Documentation closely.
201 stars 55 forks source link

What does wp.newPost return if not successful? #58

Closed encouracadopotemkin closed 6 years ago

encouracadopotemkin commented 6 years ago

Hi, in the readme it says

Returns the newly created posts ID if successful

about newPost. I need to test the return so I can do some things only in case the post was successfully created, but I'm having a hard time trying to create an error on purpose. Turns out it's pretty resilient, it creates the post even when I put nonsense into the parameters. So, what does it return when the post isn't created? An Exception? A string with the HTTP error?

zachfeldman commented 6 years ago

Hey @encouracadopotemkin , it would probably return a string but I'm honestly not sure. I agree it's hard to emulate an unsuccessful post. Why don't you just put some error tracking around your code to get alerted if an exception is thrown so you know the first time, or have your users alert you in this case so you have a way to reproduce?

encouracadopotemkin commented 6 years ago

@zachfeldman Ok, no problem. I'll get around it another way, raising an exception should work. Thanks for responding.