cancel
Showing results for 
Search instead for 
Did you mean: 

Why the error loop on a Fiori Elements application when running on SAP Work Zone(Launchpad)

LucasMagriniRigo
Participant
0 Kudos
240

I wrote a CAP application with a Fiori Elements, business as usual.

When writing an event handler, I wanted to reject, return an error, if certain condition is met:

this.on('READ', 'MyEntity', async (req) => {
  // ...
  if (!filter) {
    req.reject(500,'Please select a filter.');
  }
  // ...
  return result;
});

What happens is that, if I run the application standalone, locally, or in BTP's HTML5 Repository, it behaves correctly. When an error happens it returns the error and stops. I fix the input and the app runs fine:

One errorOne error

 

However, if I run it on SAP WorkZone, standard edition (former Launchpad), either in BTP or using the cds-launchpad-plugin, it enters in an infinite error loop:

Infinite errorsInfinite errors

and the list keeps growing. If I close the error screen it immediately re-opens and keeps outputting more errors. The only way to stop it is to exit the page.

To share some light on what's happening, it keeps sending the same "wrong" request. If I put a breakpoint in my application it will hold and stop the loop. But as soon as I release it, the front-end fails and sends the same request again.

The workaround I had to do was to catch the error and return a valid response:

try {
  //...
} catch (e) {
  // throw e; // doesn't work
  // req.reject(e.message); // doesn't work
  console.error(e.message); // log for information
  // return a valid object, but fill the values with the error information
  return [{
    title: "ERROR",
    description: e.message
  }];
}

 

Let me know if you faced something similar and if you know how to stop this infinite loop.

View Entire Topic
Paul991
Newcomer
0 Kudos

"Hi @LucasMagriniRigo,

I had the same issue and resolved it by changing the table type in the manifest.json from 'grid' to 'responsive'.

Greetings Paul