Não tenho certeza qual é o contexto completo, mas acredito que você possa fazer isto:
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
try {
// ...
} catch (e) {
popupAjaxError(e);
}
// OU
ajax("...") // Alguma função
.then(() => {
// ...
})
.catch(popupAjaxError);