on 2024 Dec 30 8:12 PM
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 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 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.
Request clarification before answering.
"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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
58 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.