question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in eventSource eventDataTransform leads to unhelpful error message

See original GitHub issue

The 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:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
koosvanderkolkcommented, Nov 19, 2019

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.

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.

1reaction
alaouycommented, Nov 18, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found