From ebe0d8056e96c1b86fb5d4688771b0ea772b4234 Mon Sep 17 00:00:00 2001 From: Haniya konain Date: Sun, 29 Mar 2026 01:23:12 +0530 Subject: [PATCH] Fix: reject promise on non-404 errors in jsonMessageLoader (fixes #255) Fixes #255 The `jsonMessageLoader` function was resolving the promise on ALL errors, including invalid JSON. Now it only resolves on 404 (for fallback handling) and rejects on all other errors. --- src/jquery.i18n.messagestore.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/jquery.i18n.messagestore.js b/src/jquery.i18n.messagestore.js index ba81ce5..67a2885 100644 --- a/src/jquery.i18n.messagestore.js +++ b/src/jquery.i18n.messagestore.js @@ -27,13 +27,13 @@ .done( deferred.resolve ) .fail( function ( jqxhr, settings, exception ) { $.i18n.log( 'Error in loading messages from ' + url + ' Exception: ' + exception ); - // Ignore 404 exception, because we are handling fallabacks explicitly - deferred.resolve(); + // Ignore 404 exception, because we are handling fallbacks explicitly + if ( jqxhr.status === 404 ) { + deferred.resolve(); + } else { + deferred.reject( exception ); + } } ); - - return deferred.promise(); - } - /** * See https://github.com/wikimedia/jquery.i18n/wiki/Specification#wiki-Message_File_Loading */