Error in eventSource eventDataTransform leads to unhelpful error message
See original GitHub issueThe evenDataTransform callback (https://fullcalendar.io/docs/eventDataTransform) allows for data processing after e.g. a JSON feed returned from the server.
When there is a problem inside this evenDataTransform callback function, e.g. a typo, one will receive a very generic error message ‘Failure parsing JSON’, as per
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 400) {
try {
var res = JSON.parse(xhr.responseText);
successCallback(res, xhr);
}
catch (err) {
failureCallback('Failure parsing JSON', xhr);
}
}
else {
failureCallback('Request failed', xhr);
}
};
A solution could be to provide the ‘err’ object with failureCallback:
4333c4333
< failureCallback('Failure parsing JSON', {"xhr": xhr});
---
> failureCallback('Failure parsing JSON', {"xhr": xhr, "err": err});
4380,4381c4380,4381
< }, function (errorMessage, xhr) {
< failure({ message: errorMessage, xhr: xhr });
---
> }, function (errorMessage, xhr, err) {
> failure({ message: errorMessage, xhr: xhr, err: err });
or only to provide the error message itself:
4333c4333
< failureCallback('Failure parsing JSON', {"xhr": xhr});
---
> failureCallback('Failure parsing JSON: ' + err.message, {"xhr": xhr});
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
FullCalendar input is undefined in eventDataTransform
I have this app with fullcalendar and everything but the eventDataTransform works fine. The code is really large, so i will publish the ......
Read more >EventSource: error event - Web APIs - MDN Web Docs - Mozilla
The error event of the EventSource API is fired when a connection with an event source fails to be opened.
Read more >Server-Sent Events - W3C
Fire a simple event named error at the EventSource object. Wait a delay equal to the reconnection time of the event source. Wait...
Read more >9.2 Server-sent events - HTML Standard - WhatWG
Fire an event named error at the EventSource object. Wait a delay equal to the reconnection time of the event source. Optionally, wait...
Read more >Event Source Object - Docs - FullCalendar
An “event source” is anything that provides FullCalendar with data about events.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, but the underlying issue is that any mistake in your code will cause the same non-descriptive error message, making it hard to debug.
Experienced the same issue, it was due to a date parsing issue on the start/end attributes, I resolved it by including the moment plugin https://fullcalendar.io/docs/moment-plugins.