Bubbling UP Error details in Node.js

Bubbling UP Error details in Node.js
The problem: We want to propagate some error details from the internal modules to the front end or to the API exposed to our code’s users. One common method of propagating the error is passing it as the second parameter of the error constructor. However, obtaining the error details requires specific syntax. The solution: In Node.js, the Error object can propagate the cause property inside the options argument. As an example, let’s say we have the function getUsers that fetches a list of users, and another module consumes that function to generate the list of elements on the UI. [Read More]

Optimal NodeJS DevContainer Package Management

Optimal NodeJS DevContainer Package Management
The problem: Each dev container that uses Npm or Yarn as package managers has to download all the “node_modules”, plus some transient ones, for each container where those files take quite a lot of disk space and time to download. The Solution: Set up a dev container with Pnpm and a global shared packages store with the host system. This approach eliminates the need to duplicate files. It saves significant network resources and time by reusing all the files that other dev containers or the host machine have already downloaded into the global store. [Read More]