aboutsummaryrefslogtreecommitdiffstats
path: root/storage_xml.c
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2015-03-07 01:10:59 -0300
committerdequis <dx@dxzone.com.ar>2015-03-10 04:33:54 -0300
commit732061027ec0d83db224e81df0fd1b3905a3cdec (patch)
treecc67cd6db47521fc5188b3eecd0b10f7a7cc0eca /storage_xml.c
parent8b91a1f60f5d27c91d5a9939236e6078a090ef92 (diff)
Various user experience/error reporting improvements
- Show version as part of the initial message of &bitlbee - Use g_strerror() to show actual errors when saving xml configs - Only show "The nick is (probably) not registered" for ENOENT, use g_strerror() for the rest of OS errors when loading xml configs - Show "Protocol not found: <name>" when find_protocol() returns null, useful when the user uninstalls a plugin accidentally. - Suggest the user to check the system clock when getting error 401 from the twitter stream (other REST endpoints show a better error message)
Diffstat (limited to 'storage_xml.c')
-rw-r--r--storage_xml.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/storage_xml.c b/storage_xml.c
index 0dd4ec53..38a73d87 100644
--- a/storage_xml.c
+++ b/storage_xml.c
@@ -102,6 +102,10 @@ static xt_status handle_account(struct xt_node *node, gpointer data)
protocol = xt_find_attr(node, "protocol");
if (protocol) {
prpl = find_protocol(protocol);
+ if (!prpl) {
+ irc_rootmsg(xd->irc, "Error loading user config: Protocol not found: `%s'", protocol);
+ return XT_ABORT;
+ }
local = protocol_account_islocal(protocol);
}
@@ -196,7 +200,11 @@ static storage_status_t xml_load_real(irc_t *irc, const char *my_nick, const cha
fn = g_strconcat(global.conf->configdir, xd->given_nick, ".xml", NULL);
if ((fd = open(fn, O_RDONLY)) < 0) {
- ret = STORAGE_NO_SUCH_USER;
+ if (errno == ENOENT) {
+ ret = STORAGE_NO_SUCH_USER;
+ } else {
+ irc_rootmsg(irc, "Error loading user config: %s", g_strerror(errno));
+ }
goto error;
}
@@ -376,8 +384,7 @@ static storage_status_t xml_save(irc_t *irc, int overwrite)
strcat(path, ".XXXXXX");
if ((fd = mkstemp(path)) < 0) {
- irc_rootmsg(irc, "Error while opening configuration file.");
- return STORAGE_OTHER_ERROR;
+ goto error;
}
tree = xml_generate(irc);
@@ -399,7 +406,7 @@ static storage_status_t xml_save(irc_t *irc, int overwrite)
goto finish;
error:
- irc_rootmsg(irc, "Write error. Disk full?");
+ irc_rootmsg(irc, "Write error: %s", g_strerror(errno));
ret = STORAGE_OTHER_ERROR;
finish: