PricingBlog

How do you manage error logging?

  • neville9288-1506011283525206164

    Neville

    9 hours ago

    Hello folks!

    I'm interested to hear how you handle error logging in your app. Here's what I am trying to figure out:

    I would like to add error handling to each API call. Some errors will be surfaced in the UI only, and some will be surfaced in the UI as well as recorded in an error_log table.

    The problem is that some pages contain 2 or 3 API endpoints, and potentially each needs error handling.

    Workflows do some of this, but a) I would have to re-create this on every page with API calls and b) they don't encapsulate the error logging api call.
    Components do some of this (encapsulation) but I would need a workflow to set each attribute and then toggle an attribute that fires the error logging api call.

    I'm sure I am not the first and pretty sure I am overlooking a simple solution. Any pointers highly appreciated - thanks!
  • jacobkofoed-1506014778504511659

    Jacob Kofoed

    9 hours ago

    I don’t have a similar case yet, but I imagine that I would have an ‘error-boundary’ component in the root of my page that has a workflow called “Log error” with parameters for UI only, title, code and description and expose the workflow in context and call it on each API.

    Maybe that’s what you tried already but didn’t quite cut it for you?
  • neville9288-1506034555147255869

    Neville

    7 hours ago

    That's pretty much what I had in mind Jacob, thanks. I will experiment and post back here when I have something working.