3

MFE = micro-front-end

I'm trying to import 1 MFE to another MFE. MFE-food calls MFE-cart. When MFE-cart is down, there is an impact on MFE-food, my expectation is MFE should run properly.

in root-config, I have added

addErrorHandler(err => {
  if (getAppStatus(err.appOrParcelName) === LOAD_ERROR) {
    System.delete(System.resolve(err.appOrParcelName));
  }
});

in console, there is an error message like this. I must handle this error so MFE-food can run independently whether MFE-cart is running or not

system.js:654 GET http://localhost:9006/hotel-cart.js net::ERR_CONNECTION_REFUSED 200
system.js:637 Uncaught (in promise) Error: application '@hotel/food' died in status LOADING_SOURCE_CODE: Error loading http://localhost:9006/hotel-cart.js from http://localhost:9005/hotel-food.js (SystemJS Error#3 https://git.io/JvFET#3)
    at HTMLScriptElement.<anonymous> (system.js:637)
Vzans
  • 91
  • 1
  • 6
  • First, put a try catch block around your code that catches that Promise rejection. Then, inside that catch block (or chained method), throw an [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw). Then you can have a handler deal with the custom error. – Randy Casburn Jan 04 '22 at 16:27

0 Answers0