JSFiddle - React, Tailwind, and code Playground

JavaScript

$(document).ajaxError(function () {
            // never fires...
            alert("AJAX error occurred...");
        });

        $(function () {
            $.ajax({
                url: '/nonexistent/url',
                error: function () {
                    // comment out the line below and the global ajaxError fires correctly
                    throw "manual error";
                }
            });
        });