]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lazy-expunge: Log internal errors instead of just "Internal error occurred"
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 4 Aug 2017 15:20:50 +0000 (18:20 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 4 Aug 2017 15:20:50 +0000 (18:20 +0300)
src/plugins/lazy-expunge/lazy-expunge-plugin.c

index 20ddceffb5f99613460d5a57c2835f8f081950b6..ce7c02ed868a0420bda9f6b05f83dc4fce37f95b 100644 (file)
@@ -59,6 +59,7 @@ struct lazy_expunge_transaction {
        HASH_TABLE(const char *, void *) guids;
 
        char *delayed_errstr;
+       char *delayed_internal_errstr;
        enum mail_error delayed_error;
 
        bool copy_only_last_instance;
@@ -271,6 +272,8 @@ static void lazy_expunge_set_error(struct lazy_expunge_transaction *lt,
                return;
        lt->delayed_error = error;
        lt->delayed_errstr = i_strdup(errstr);
+       lt->delayed_internal_errstr =
+               i_strdup(mail_storage_get_last_internal_error(storage, NULL));
 }
 
 static void lazy_expunge_mail_expunge(struct mail *_mail)
@@ -398,6 +401,7 @@ static void lazy_expunge_transaction_free(struct lazy_expunge_transaction *lt)
        if (lt->pool != NULL)
                pool_unref(&lt->pool);
        i_free(lt->delayed_errstr);
+       i_free(lt->delayed_internal_errstr);
        i_free(lt);
 }
 
@@ -424,7 +428,8 @@ lazy_expunge_transaction_commit(struct mailbox_transaction_context *ctx,
                ret = -1;
        } else {
                mail_storage_set_critical(ctx->box->storage,
-                       "Lazy-expunge transaction failed: %s", lt->delayed_errstr);
+                       "Lazy-expunge transaction failed: %s",
+                       lt->delayed_internal_errstr);
                mbox->super.transaction_rollback(ctx);
                ret = -1;
        }