How to deal with client API precondition failures

Alexandros Frantzis alexandros.frantzis at canonical.com
Wed Nov 26 12:09:29 UTC 2014


Hi all,

in a recent review the subject of how to deal with precondition failures
in the client API came up again. In discussions we had yesterday the
consensus was that we should abort the process. This has the benefit of
catching the error as early as possible, making debugging much easier.

The drawback versus a more forgiving approach is that and some programs
may not be able to deal with such abrupt failures well. However,
programs that absolutely need to do some critical cleanup should handle
such failures anyway, regardless of whether they come from the Mir
client library or not.

This is not a new discussion, but we hadn't explicitly stated any
guidelines before, so we had not been actively encouraging such handling
of precondition failures during reviews.

So, the proposed guideline is: abort on precondition failures in client
API functions. This can be best achieved with a mir_assert() or similar
function/macro that will be always on regardless of the build type.

Thoughts?

Thanks,
Alexandros



More information about the Mir-devel mailing list