Firefly Request

@tatianag

We have a request to make the getJSONFromTask function more helpful on failure. Right now, if something went wrong while trying to execute a task script, we get the error message “edu.caltech.ipac.firefly.server.query.DataAccessException: Unable to data from external task: Failed to obtain data. null”, which isn’t very helpful in tracking down the problem. It would be really great if we could get a better message telling us the problem. For instance, firefly couldn’t find the dispatcher file, or if there was a syntax error somewhere tell us which file and line. It would make debugging these problems infinitely easier

We can certainly improve error handling. I’ll create a ticket for it.

Meanwhile you can look at server log. If you had invalid JSON, you’d see something like “invalid JSON in taskParams; position: …” Also make sure your python task works from command line and always writes either “outfile” or “error” in the task status part of the output. The error from python is what you would see instead of “null” in the end of the message you have cited.

Just for tracking purposes: here is the ticket.

@tony_johnson The new Firefly release is available at https://github.com/Caltech-IPAC/firefly (check latest release and master branch).

It includes error handling improvements for getJsonFromTask functions, requested by @jbpagliuco. Errors from server side are passed to the client, use catch clause to capture them:

firefly.getJsonFromTask('python', 'JsonTaskName', taskParams)
    .then(function (data) {
        console.log(data);
    })
    .catch(function (reason) {
        console.error('Error fetching JSON data from ' + launcher + ' task ' + task + ': ' + reason);
    });