]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: Improve error messages
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 23 Oct 2017 09:01:27 +0000 (12:01 +0300)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Sat, 28 Oct 2017 10:28:19 +0000 (13:28 +0300)
src/plugins/quota/quota-storage.c
src/plugins/quota/quota.c

index 95e794d576624ca4a490787888cda926b0eeb8f7..0d27d74432f8f3fa878e7d0330edb3017519710d 100644 (file)
@@ -259,7 +259,7 @@ static int quota_check(struct mail_save_context *ctx, struct mailbox *src_box)
                return 0;
        case QUOTA_ALLOC_RESULT_TEMPFAIL:
                /* Log the error, but allow saving anyway. */
-               i_error("quota check failed: %s", error);
+               i_error("quota: Failed to check if user is under quota: %s - saving mail anyway", error);
                return 0;
        default:
                quota_set_storage_error(qt, t->box->storage, ret, error);
@@ -321,7 +321,7 @@ quota_save_begin(struct mail_save_context *ctx, struct istream *input)
                        break;
                case QUOTA_ALLOC_RESULT_TEMPFAIL:
                        /* Log the error, but allow saving anyway. */
-                       i_error("quota allocation failed: %s", error);
+                       i_error("quota: Failed to check if user is under quota: %s - saving mail anyway", error);
                        break;
                default:
                        quota_set_storage_error(qt, t->box->storage, qret, error);
index 988328c61563380a8cffed54d0e1b34b7c804653..7ef5e2514fe6f4132fb8cab36d194deb8376e658 100644 (file)
@@ -759,6 +759,7 @@ quota_get_resource(struct quota_root *root, const char *mailbox_name,
                   const char *name, uint64_t *value_r, uint64_t *limit_r,
                   const char **error_r)
 {
+       const char *error;
        uint64_t bytes_limit, count_limit;
        bool ignored, kilobytes = FALSE;
        int ret;
@@ -772,17 +773,13 @@ quota_get_resource(struct quota_root *root, const char *mailbox_name,
 
        /* Get the value first. This call may also update quota limits if
           they're defined externally. */
-       const char *error;
-       ret = root->backend.v.get_resource(root, name, value_r, &error);
+       ret = root->backend.v.get_resource(root, name, value_r, error_r);
        if (ret < 0) {
-               *error_r = t_strdup_printf(
-                       "Could not get %s from quota backend for mailbox %s: %s",
-                       name, mailbox_name, error);
                return QUOTA_GET_RESULT_INTERNAL_ERROR;
        } else if (ret == 0) {
                *error_r = t_strdup_printf(
-                       "Requested resource %s for mailbox %s is unkown",
-                       name, mailbox_name);
+                       "Quota backend %s doesn't support requested resource %s",
+                       root->backend.name, name);
                return QUOTA_GET_RESULT_UNKNOWN_RESOURCE;
        }
 
@@ -790,7 +787,8 @@ quota_get_resource(struct quota_root *root, const char *mailbox_name,
                                       &bytes_limit, &count_limit,
                                       &ignored, &error) < 0) {
                *error_r = t_strdup_printf(
-                       "Failed to get quota root rule limits: %s", error);
+                       "Failed to get quota root rule limits for mailbox %s: %s",
+                       mailbox_name, error);
                return QUOTA_GET_RESULT_INTERNAL_ERROR;
        }