Server Error fetchResponse Salesforce Lightning Web Component

Server Error fetchResponse Salesforce Lightning Web Component

Exception:

"statusText": "Server Error",
"errorType": "fetchResponse"

Resolution:

The exception is thrown when the Salesforce Lightning Web Component calls apex and the apex execution fails due to incorrect data passed from the Lightning Web Component JavaScript to the Apex. Use try and catch block in apex to handle the exception.

Example:

When we use Date data type, Apex expects it to be in YYYY-MM-DD format. In JavaScript, getDate() returns single digit for 1st to 9th. So, if we pass YYYY-MM-D instead of YYYY-MM-DD, it will throw this exception.

Leave a Reply