core: start using our newly defined errors

This commit is contained in:
Aleksander Morgado
2011-11-23 12:36:47 +01:00
parent e4d8c4ace7
commit c58db4e015
23 changed files with 414 additions and 731 deletions

View File

@@ -24,6 +24,9 @@
#include <string.h>
#include <unistd.h>
#include <ModemManager.h>
#include <mm-errors-types.h>
#include "mm-log.h"
enum {
@@ -176,7 +179,8 @@ mm_log_set_level (const char *level, GError **error)
}
}
if (!found)
g_set_error (error, 0, 0, "Unknown log level '%s'", level);
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
"Unknown log level '%s'", level);
return found;
}
@@ -206,13 +210,14 @@ mm_log_setup (const char *level,
O_CREAT | O_APPEND | O_WRONLY,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
if (logfd < 0) {
g_set_error (error, 0, 0, "Failed to open log file: (%d) %s",
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
"Couldn't open log file: (%d) %s",
errno, strerror (errno));
return FALSE;
}
}
g_log_set_handler (G_LOG_DOMAIN,
g_log_set_handler (G_LOG_DOMAIN,
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
log_handler,
NULL);