All Questions
Tagged with error-handling express
409
questions
1
vote
1
answer
34
views
error handling outputs html instead json in express
i followed the express.js 's tutorial to make a simple errorhandler
function clientErrorHandler(err, req, res, next) {
if (req.xhr) {
console.log('clienterrorhandler', err);
res.status(500)....
0
votes
0
answers
32
views
Node.js Server Error: EADDRINUSE - Address Already in Use Despite Terminating Process
After 1st time successfully started server and when I again start my server then I'm encountering an issue with my Node.js server where I receive the following error message:
node:events:496
throw er; ...
0
votes
0
answers
121
views
npm ERR! Could not resolve dependency npm ERR! peer cloudinary@"^1.21.0" from [email protected]
I am deploying mern project in Vercel
It is running on localhost but when i deploy it on vercel i get the following error
vercel Log
{
"engines": {
"node": "20.x"
...
0
votes
1
answer
41
views
Getting Error while using error class to handle global error handling in express
I am a newbie to express and have one error while handling an error using a custom class for error and middleware.
app.error.ts
export class AppError extends Error {
statusCode: number;
...
1
vote
2
answers
276
views
Where to throw Errors on MVC Model: Service or Controller?
I'm creating an Backend with Express using the MVC Model, but I still don't know where to throw the errors.
I'm using the express-async-errors and the http-errors
, so I can throw the Error anywhere, ...
-1
votes
1
answer
31
views
new to express & js and trying to understand next
This is new to me and Im trying to learn so my terminology and code may be not be the best :).
I have code like below. createCustomer adds row to a table. My intention is if missing data then dont ...
0
votes
0
answers
34
views
getting error 422 (Unprocessable entity) in a api-integration webapp
I'm a beginner in Node and webdev, and recently build a chatbot using MERN and chatgpt-api integration. when I'm trying to send message as user to the api using my frontend. I'm getting "Failed ...
0
votes
0
answers
28
views
Node.js Typescript Express Error handling middleware
I'm trying to build an error middleware for error handling my backend routes, but for some reason it's not catching the errors, can someone help me with this?
App.ts
import { Middlewares } from "@...
0
votes
1
answer
41
views
MySQL ERR in Express Back-End Server
I am facing an MySQL err while I am executing a query on my Express server.
My code is as follows.
module.exports.generateDailyWords = async function () {
try {
// generate the shape of word ...
0
votes
1
answer
43
views
How to type get error response data from axios AsyncThunk
I am having a hard time access the error response data, The code worked on javascript I moved to typescript now things are confusing. Currently i get 'error' is of type 'unknown'.ts(18046)
export ...
0
votes
1
answer
60
views
My error handler return error in console not in reponser, why? [closed]
This is my first question, I'm sorry if I did something wrong and I'm open to suggestions to ask better questions.
My error handler dont show the message in response, the message show in console app ...
0
votes
1
answer
31
views
Create an errorHandler to handle all error cases with Express js
I have created an errorMiddleware class in my Nodejs api :
const { appLogger } = require('../utils/logger');
const { getENVValue } = require('../utils/fonction');
const CustomException = require('../...
0
votes
2
answers
56
views
NodeJS Express Error Coming as html in Angular Frontend
I have a nodejs server that uses the next() to catch errors. The issue I am running into is the thrown error is returning to the frontend in html. How can I change it to JSON.
A sample of my ...
0
votes
1
answer
27
views
NodeJS Express app.use want fire function with more than two arguments
I actually working on a project running with NodeJS 18.17.1 and use Express 4.18.2.
Everything runs as expected, all routes are up, passport is doing its job but my error handling wont work as it ...
0
votes
0
answers
100
views
Best Practices express.js
I am working on a simple project to learn Express.js.
I need some clarifications on best practices for error handling.
What I have done so far:
Initially, I had try-catch blocks in each function in ...