Node.js
Fondamental
Implementing basic error handling middleware in Express

Type d'évaluation

Mise en situation réelle

Analyse

Intelligence Artificielle

Compétences ciblées

nodejs
express
error-handling
middleware
api

Scénario Technique

Context An Express application crashes with unhandled errors that reach the client as HTML error pages instead of JSON responses. The Problem There is no centralized error handling, so every route must individually handle errors or the default Express handler exposes stack traces to clients. Constraints Create a four-argument Express error middleware (err, req, res, next). Catch errors thrown in routes using next(err). Return JSON error responses with status code and message. Log the error stack to the console. Expected Deliverable An Express application with a centralized error handling middleware returning JSON error responses and preventing stack trace exposure.

Prêt à évaluer ce talent ?

Accédez à l'interface de test complète pour soumettre votre architecture ou votre code.

Commencer le Défis