[glom] libglom: Return more detailed database-startup errors.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] libglom: Return more detailed database-startup errors.
- Date: Mon, 11 Nov 2013 10:22:47 +0000 (UTC)
commit f71dacea0f5dfceaaca592b38cd18dc1f6657fc4
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Nov 11 10:20:57 2013 +0100
libglom: Return more detailed database-startup errors.
glom/libglom/connectionpool_backends/backend.h | 2 ++
glom/libglom/connectionpool_backends/mysql_self.cc | 6 ++----
.../connectionpool_backends/postgres_self.cc | 6 ++----
3 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/glom/libglom/connectionpool_backends/backend.h b/glom/libglom/connectionpool_backends/backend.h
index 9d7e554..7e23686 100644
--- a/glom/libglom/connectionpool_backends/backend.h
+++ b/glom/libglom/connectionpool_backends/backend.h
@@ -82,6 +82,8 @@ public:
STARTUPERROR_NONE, /*< The database is ready for use. */
STARTUPERROR_FAILED_NO_DATA, /*< There is no data for the database. */
STARTUPERROR_FAILED_NO_DATA_HAS_BACKUP_DATA, /*< There is no data for the database, but there is a
backup file instead. */
+ STARTUPERROR_FAILED_NO_MAIN_DIRECTORY, /*< The main directory (containing data and config directories)
could not be found. */
+ STARTUPERROR_FAILED_NO_PORT_AVAILABLE, /*< There was no network port available in the normal range of
ports. */
STARTUPERROR_FAILED_UNKNOWN_REASON /*< Something else failed. */
};
diff --git a/glom/libglom/connectionpool_backends/mysql_self.cc
b/glom/libglom/connectionpool_backends/mysql_self.cc
index 38f2118..74fcc9e 100644
--- a/glom/libglom/connectionpool_backends/mysql_self.cc
+++ b/glom/libglom/connectionpool_backends/mysql_self.cc
@@ -305,9 +305,8 @@ Backend::StartupErrors MySQLSelfHosted::startup(const SlotProgress& slot_progres
if(!(file_exists_uri(dbdir_uri)))
{
- //TODO: Use a return enum or exception so we can tell the user about this:
std::cerr << G_STRFUNC << ": The data directory could not be found: " << dbdir_uri << std::endl;
- return STARTUPERROR_FAILED_UNKNOWN_REASON;
+ return STARTUPERROR_FAILED_NO_MAIN_DIRECTORY;
}
const std::string dbdir = Glib::filename_from_uri(dbdir_uri);
@@ -339,9 +338,8 @@ Backend::StartupErrors MySQLSelfHosted::startup(const SlotProgress& slot_progres
//std::cout << "debug: " << G_STRFUNC << ":() : debug: Available port for self-hosting: " <<
available_port << std::endl;
if(available_port == 0)
{
- //TODO: Use a return enum or exception so we can tell the user about this:
std::cerr << G_STRFUNC << ": No port was available between " << PORT_MYSQL_SELF_HOSTED_START << " and "
<< PORT_MYSQL_SELF_HOSTED_END << std::endl;
- return STARTUPERROR_FAILED_UNKNOWN_REASON;
+ return STARTUPERROR_FAILED_NO_PORT_AVAILABLE;
}
//TODO: Performance:
diff --git a/glom/libglom/connectionpool_backends/postgres_self.cc
b/glom/libglom/connectionpool_backends/postgres_self.cc
index d32cbff..fc27f69 100644
--- a/glom/libglom/connectionpool_backends/postgres_self.cc
+++ b/glom/libglom/connectionpool_backends/postgres_self.cc
@@ -353,9 +353,8 @@ Backend::StartupErrors PostgresSelfHosted::startup(const SlotProgress& slot_prog
if(!(file_exists_uri(dbdir_uri)))
{
- //TODO: Use a return enum or exception so we can tell the user about this:
std::cerr << G_STRFUNC << ": The data directory could not be found: " << dbdir_uri << std::endl;
- return STARTUPERROR_FAILED_UNKNOWN_REASON;
+ return STARTUPERROR_FAILED_NO_MAIN_DIRECTORY;
}
const std::string dbdir = Glib::filename_from_uri(dbdir_uri);
@@ -387,9 +386,8 @@ Backend::StartupErrors PostgresSelfHosted::startup(const SlotProgress& slot_prog
//std::cout << "debug: " << G_STRFUNC << ":() : debug: Available port for self-hosting: " <<
available_port << std::endl;
if(available_port == 0)
{
- //TODO: Use a return enum or exception so we can tell the user about this:
std::cerr << G_STRFUNC << ": No port was available between " << PORT_POSTGRESQL_SELF_HOSTED_START << "
and " << PORT_POSTGRESQL_SELF_HOSTED_END << std::endl;
- return STARTUPERROR_FAILED_UNKNOWN_REASON;
+ return STARTUPERROR_FAILED_NO_PORT_AVAILABLE;
}
//TODO: Performance:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]