The Meditations
25 November 2015 • Less than a minute read

Error Handling With Promises

The analogy is that of a building under construction, when workers are building safety nets are placed to prevent their fall. Now consider the following two buildings, where would you place the safety nets?.

Callback Hell

|---------------------------------| |------------------------| |----------------| |--------| |--| -----------------------------------

You must place the nets on each floor.

Promises

|---------------------------------| |---------------------------------| |---------------------------------| |---------------------------------| |---------------------------------| -----------------------------------

You can do away with a single net at the bottom floor!.

Post by: Ajinkya Tejankar