On 22 February 2010 16:17, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Mon, 22 Feb 2010, Alexander Lamaison wrote:
>> I'm creating C++ bindings for libssh2 and, while working out the exception
>> strategy, I noticed that some API calls set an error message using
>> libssh2_error when they are about to return a failure code and others don't.
>> Specifically, the knownhosts api never calls libssh2_error. I noticed that
>> Daniel recently committed some changes to userauth that made all API calls
>> use libssh2_error but do we have a coherent policy on this?
> I agree that we need to make sure this is consistently done, and I think the
> only sensible thing to do here is to make us ALWAYS use libssh2_error() when
> we return errors.
The attached patch adds libssh2_error calls to the knownhosts API.
Daniel, can you look at the error message text to make sure it matches
The only other controversial thing about this patch is that it removes
the LIBSSH2_KNOWNHOST_CHECK_FAILURE result from
libssh2_knownhost_check. Most other APIs return a negative value on
an unexpected failure (as opposed an expected negative result).
knownhost_check didn't so for consistent error handling I've changed
it here. This may break existing code (though I'm not sure many
people use the knownhost API yet) so you may disagree with this.
Received on 2010-02-23