aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2009-10-23 17:27:30 +0200
committerJay Berkenbilt <ejb@ql.org>2009-10-23 17:27:30 +0200
commit7f5d78c2d15565dd8a2357268f187045eb3ebc27 (patch)
treea39638f657b89d6d072a5b4c293eae9de51c48ed /include
parent75ea1971fa275613380dacef5dee0fc0bb9ccc45 (diff)
downloadqpdf-7f5d78c2d15565dd8a2357268f187045eb3ebc27.tar.zst
improve C error handling interface
git-svn-id: svn+q:///qpdf/trunk@884 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/Constants.h3
-rw-r--r--include/qpdf/qpdf-c.h16
2 files changed, 14 insertions, 5 deletions
diff --git a/include/qpdf/Constants.h b/include/qpdf/Constants.h
index eb872788..d74cace3 100644
--- a/include/qpdf/Constants.h
+++ b/include/qpdf/Constants.h
@@ -17,8 +17,7 @@
enum qpdf_error_code_e
{
- qpdf_e_success = 0,
- qpdf_e_internal, /* logic/programming error -- indicates bug */
+ qpdf_e_internal = 1, /* logic/programming error -- indicates bug */
qpdf_e_system, /* I/O error, memory error, etc. */
qpdf_e_unsupported, /* PDF feature not (yet) supported by qpdf */
qpdf_e_password, /* incorrect password for encrypted file */
diff --git a/include/qpdf/qpdf-c.h b/include/qpdf/qpdf-c.h
index 0980f1f7..492a72ba 100644
--- a/include/qpdf/qpdf-c.h
+++ b/include/qpdf/qpdf-c.h
@@ -106,9 +106,18 @@ extern "C" {
/* ERROR REPORTING */
+ /* Returns 1 if there is an error condition. The error condition
+ * can be retrieved by a single call to qpdf_get_error.
+ */
+ QPDF_DLL
+ QPDF_BOOL qpdf_has_error(qpdf_data qpdf);
+
/* Returns the error condition, if any. The return value is a
- * pointer to data that will become invalid the next time an error
- * occurs or after this function is called gain.
+ * pointer to data that will become invalid after the next call to
+ * this function, qpdf_next_warning, or qpdf_destroy. After this
+ * function is called, qpdf_has_error will return QPDF_FALSE until
+ * the next error condition occurs. If there is no error
+ * condition, this function returns a null pointer.
*/
QPDF_DLL
qpdf_error qpdf_get_error(qpdf_data qpdf);
@@ -133,7 +142,8 @@ extern "C" {
char const* qpdf_get_error_full_text(qpdf_data q, qpdf_error e);
/* Use these functions to extract individual fields from the
- * error; see QPDFExc.hh for details. */
+ * error; see QPDFExc.hh for details. It is invalid for e to be a
+ * null pointer for any of these calls. */
QPDF_DLL
enum qpdf_error_code_e qpdf_get_error_code(qpdf_data q, qpdf_error e);
QPDF_DLL