Skip to content

Commit

Permalink
quota: Improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen authored and cmouse committed Oct 28, 2017
1 parent 39eefc5 commit d81702d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/plugins/quota/quota-storage.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
14 changes: 6 additions & 8 deletions src/plugins/quota/quota.c
Expand Up @@ -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;
Expand All @@ -772,25 +773,22 @@ 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;
}

if (quota_root_get_rule_limits(root, 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;
}

Expand Down

0 comments on commit d81702d

Please sign in to comment.