Add error logging/monitoring to failing queries

I'm trying to get some sort of error logging set up. My initial idea was to:

  • Create a generic JS query that handles errors (input, transform and where to send it)
  • Add that JS query to the onFailure callback of an existing query
  • Process the error, #profit

But I can't seem to access the .data or .error functions of the CALLING query.

I'm not triggering the onFailure callback manually. I'm using the native callback in the query settings.

Anyone set up something similar before? How did you manage that?