Plugin Directory

Changeset 3843563


Ignore:
Timestamp:
12/03/2026 11:49:23 PM (less than one hour ago)
Author:
WayneAllen
Message:

Improve Postie admin error diagnostics

Location:
postie/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • postie/trunk/docs/Changes.txt

    r3821111 r3843563  
    3434
    3535== CHANGELOG ==
     36= Unreleased =
     37* Show the HTTP status when available and distinguish timeouts, invalid responses, and missing responses in the manual mail check, Debug, and configuration test dialogs.
     38
    3639= 1.9.92 (2026-11-24) =
    3740* Fix query logging recursion and out-of-memory errors via re-entrancy guard
  • postie/trunk/js/postie-admin.js

    r3793477 r3843563  
    209209}
    210210
     211function postieAjaxErrorMessage(strings, httpStatus, ajaxStatus) {
     212    var message = strings.serverError || 'An unexpected server error occurred.';
     213    if (ajaxStatus === 'parsererror') {
     214        message = strings.invalidServerResponse || 'The server returned an invalid response.';
     215    } else if (ajaxStatus === 'timeout') {
     216        message = strings.requestTimeout || 'The request timed out.';
     217    } else if (httpStatus === 0) {
     218        message = strings.noServerResponse || 'No HTTP response was received.';
     219    }
     220
     221    return httpStatus > 0 ? message + ' (HTTP ' + httpStatus + ')' : message;
     222}
     223
    211224function runPostieMailCheck(isDebug) {
    212225    var strings = (window.postieAdminData && window.postieAdminData.strings) ? window.postieAdminData.strings : {};
    … …  
    241254            renderPostieModalResult(response, isDebug);
    242255        },
    243         error: function (xhr, status, error) {
    244             var errorMsg = (strings.serverError || 'An unexpected server error occurred.') + ' (' + (error || status) + ')';
    245             renderPostieModalError(errorMsg, []);
     256        error: function (xhr, status) {
     257            renderPostieModalError(postieAjaxErrorMessage(strings, xhr.status, status), []);
    246258        },
    247259        complete: function () {
    … …  
    282294            renderPostieTestResult(response);
    283295        },
    284         error: function (xhr, status, error) {
    285             var errorMsg = (strings.serverError || 'An unexpected server error occurred.') + ' (' + (error || status) + ')';
    286             renderPostieModalError(errorMsg, []);
     296        error: function (xhr, status) {
     297            renderPostieModalError(postieAjaxErrorMessage(strings, xhr.status, status), []);
    287298        },
    288299        complete: function () {
    … …  
    672683        sanitizePreviewHtml: sanitizePreviewHtml,
    673684        escapePostieHtml: escapePostieHtml,
     685        postieAjaxErrorMessage: postieAjaxErrorMessage,
    674686        applyTemplatePlaceholders: applyTemplatePlaceholders
    675687    };
  • postie/trunk/postie.php

    r3821111 r3843563  
    269269                    'errorsEncountered' => __('Errors Encountered', 'postie'),
    270270                    'serverError'       => __('An unexpected server error occurred.', 'postie'),
     271                    'invalidServerResponse' => __('The server returned an invalid response.', 'postie'),
     272                    'requestTimeout'    => __('The request timed out.', 'postie'),
     273                    'noServerResponse'  => __('No HTTP response was received.', 'postie'),
    271274                    'testingConfig'     => __('Testing configuration...', 'postie'),
    272275                    'testingConfigDesc' => __('Connecting to mail server and verifying configuration. Please wait...', 'postie'),
Note: See TracChangeset for help on using the changeset viewer.