DEV Community

Cover image for The Importance of Reading Between the Errors: My 'Prettier' Saga
programequity
programequity

Posted on

The Importance of Reading Between the Errors: My 'Prettier' Saga

By Maye (Naomi) Jesuorobo

Recently, I decided to take the plunge into the world of open-source contribution. I was fortunate to meet a kind and generous group of people at Program Equity and work on their app, Amplify. Amplify is a U.S based, open-source, non-profit organization created for individuals to take the initiative in being part of an actionable step in the efforts to protect against climate change and find Civil Rights causes and Indigenous People’s causes that they support.

While working on my chosen endpoint API, I encountered an unexpected challenge. After adding a Jest test into my code and attempting to push the changes for a pull request, I was surprised to see that I couldn't proceed. It was a unique situation for me, given my familiarity with similar workflows in the past.

Initially, I quickly skimmed through the error message to identify the issue, only to discover there were two messages. The first, a lengthy one, focused on reapplying my stash, while the second, smaller but would be crucial, indicated that 'prettier' had not been formatted. Unfortunately, I overlooked the second error message and concentrated solely on the first.

In an effort to sync my branch with the main one, as suggested by the initial error message, I executed a series of Git commands, including 'git stash,' 'git rebase,' and 'git stash apply.' Despite my persistent attempts, I consistently encountered an error, hinting at uncommitted changes in my stash and other issues. Frustrated, I diligently recommitted changes, experimenting with various git commands to reapply stashes, and repeatedly attempted to push, only to hit the same roadblock.

It wasn't until I was on the verge of seeking assistance from a project maintainer - typing out my message to explain the problem I was facing - that I realized I hadn't thoroughly read the error messages. Upon revisiting them, I decided to scrutinize the second, shorter error message about 'prettier'. While I knew 'prettier' was commonly used for code formatting, I hadn't realized it could prevent pushes and cause such complications.

Determined to resolve the issue, I delved into understanding how to resolve the issue the error message was referring to and discovered that I needed to apply 'prettier --write .' due to the 'Prettier' package before pushing. Prettier, as it turns out, plays a vital role in organizing the codebase for improved readability. After spending over an hour attempting to force a push, I finally yielded to reading the error message in its entirety. Surprisingly, applying the 'Prettier' package proved to be the missing piece.

This experience, while initially frustrating, served as a potent reminder of a fundamental lesson – the significance of thoroughly reading error messages, regardless of their length. Despite nearly two hours of struggling to do things my way, a simple acknowledgment of the error message's guidance swiftly resolved the issue. Lesson learned: patience and careful attention to error messages can save a considerable amount of time and effort in the development process.

References:

Top comments (0)