Home GnuPG

Make checking if Error represents success or error more easy

Description

Make checking if Error represents success or error more easy

* src/context.cpp, src/error.h (Error::isSuccess, Error::isError): New.
* src/error.h (Error::operator bool): Use Error::isError.

These new methods complement Error::isCanceled(). For each instance of
Error exactly one of the three functions isSuccess, isCanceled, isError
returns true.

This revision also fixes the bug that for an Error created with
Error::fromCode(GPG_ERR_NO_ERROR) the bool operator returned true.

Details

Provenance
ikloeckerAuthored on Mon, May 12, 4:39 PM
Parents
rGPGMEPP4b9b73a8b2da: Replace usage of safe-bool idiom with explicit conversion operator
Branches
Unknown
Tags
Unknown
References
HEAD -> master