JavaScript exercise: Fix a Promise chain swallowing payment errors — learn re-throwing in .catch()


JavaScript Promise error handling exercise where a payment processing chain silently converts gateway rejections into successful resolutions because the .catch() handler logs the error but returns undefined instead of re-throwing. Learn how .catch() functions as a recovery handler in promise chains, why returning undefined from a catch handler settles the chain as fulfilled with value undefined, and the difference between throw error and returning a rejected promise. Covers promise rejection propagation, error handling in async chains, and why catch handlers that silently consume errors can mask critical failures in production systems. Both the broken chain where callers never see the gateway error and the corrected version with re-throw are provided with full explanation.

Comentarii

Niciun comentariu încă. Fii primul care își împărtășește părerea.
Nivel mediu
0,0 (0)

Autor

Software engineer and the creator of the Bytestark learning platform