summaryrefslogtreecommitdiff
path: root/src/utils/parserutilserror.h
diff options
context:
space:
mode:
authorAndrew Sidwell <andy@entai.co.uk>2008-09-24 13:57:27 +0000
committerAndrew Sidwell <andy@entai.co.uk>2008-09-24 13:57:27 +0000
commit96999ae441597cd5a8300658ad76a90fe02954b0 (patch)
tree98a097d55d9d4b3759240de23daf1655460124ef /src/utils/parserutilserror.h
parent79e5d74377af803222fb9c84bd97d624aafec39b (diff)
downloadlibhubbub-96999ae441597cd5a8300658ad76a90fe02954b0.tar.gz
libhubbub-96999ae441597cd5a8300658ad76a90fe02954b0.tar.bz2
Report errors from libparserutils better.
svn path=/trunk/hubbub/; revision=5431
Diffstat (limited to 'src/utils/parserutilserror.h')
-rw-r--r--src/utils/parserutilserror.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/utils/parserutilserror.h b/src/utils/parserutilserror.h
new file mode 100644
index 0000000..3e05524
--- /dev/null
+++ b/src/utils/parserutilserror.h
@@ -0,0 +1,41 @@
+/*
+ * This file is part of Hubbub.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
+ */
+
+#ifndef hubbub_utils_parserutilserror_h_
+#define hubbub_utils_parserutilserror_h_
+
+#include <parserutils/errors.h>
+
+#include <hubbub/errors.h>
+
+/**
+ * Convert a ParserUtils error into a LibCSS error
+ *
+ * \param error The ParserUtils error to convert
+ * \return The corresponding LibCSS error
+ */
+static inline hubbub_error hubbub_error_from_parserutils_error(
+ parserutils_error error)
+{
+ if (error == PARSERUTILS_OK)
+ return HUBBUB_OK;
+ else if (error == PARSERUTILS_NOMEM)
+ return HUBBUB_NOMEM;
+ else if (error == PARSERUTILS_BADPARM)
+ return HUBBUB_BADPARM;
+ else if (error == PARSERUTILS_INVALID)
+ return HUBBUB_INVALID;
+ else if (error == PARSERUTILS_FILENOTFOUND)
+ return HUBBUB_FILENOTFOUND;
+ else if (error == PARSERUTILS_NEEDDATA)
+ return HUBBUB_NEEDDATA;
+
+ return HUBBUB_UNKNOWN;
+}
+
+#endif
+