Promise rejected means issue in promise code not issue with promise plumbing

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the javascript category.

Last Updated: 2024-11-23

When I first started using promises, I got thrown by the error "promise rejected". I assumed that the bug was due to how I had set up the plumbing for my promises.

In actual fact, it just means an exception was raised. If I had looked more closely, I would have seen the root cause was an error Cannot read property postCode of undefined inside the promise.