cloud-gov / cg-ui

for the 2024 18F-supported cloud.gov product UI formerly known as the Stratos Dashboard
Other
3 stars 0 forks source link

Implement error logging in app (dev only) #194

Open jduss4 opened 4 months ago

jduss4 commented 4 months ago

As of #187 we have separated out the functions that make CF requests and logic that sits between those requests and the UI (controllers). We want to include logging that helps a developer determine when something has gone wrong while passing less detailed messages to the user.

The use of console.error lines in the app interferes with the functioning of the jest test suite. Broadly, we have a couple questions to figure out:

  1. How do we want to log developer-centric messages / errors?
  2. How do we want to configure our test suite to accommodate these errors?
  3. What level / location should these errors be visible? Local dev vs deployed dev? Production?

This task is not for Implementing a final telemetry tool—it's for development use only.

jduss4 commented 3 months ago

We may have made some decisions in this area by switching to using this type of block:

if (process.env.NODE_ENV == 'development') {
      console.error('some error message')
    }

I suspect this might benefit from being pulled out into a reusable function so that it would be easier to change up if in the future we want to alter the behavior.