fix: handle express asynx errors

This commit is contained in:
lesion 2024-06-26 15:34:33 +02:00
parent a8bfc108a2
commit da40af8a75
No known key found for this signature in database
GPG key ID: 352918250B012177
3 changed files with 21 additions and 19 deletions

View file

@ -34,13 +34,13 @@
"yarn.lock"
],
"engines": {
"node": ">=14 <=18"
"node": ">=14 <=22"
},
"dependencies": {
"@mdi/js": "^7.3.67",
"@mdi/js": "^7.4.47",
"@nuxtjs/auth": "^4.9.1",
"@nuxtjs/axios": "^5.13.5",
"@nuxtjs/i18n": "^7.3.0",
"@nuxtjs/axios": "^5.13.6",
"@nuxtjs/i18n": "^7.3.1",
"@nuxtjs/sitemap": "^2.4.0",
"@peertube/http-signature": "^1.7.0",
"accept-language": "^3.0.18",
@ -51,20 +51,21 @@
"cookie-universal-nuxt": "^2.2.2",
"cors": "^2.8.5",
"dayjs": "^1.11.11",
"dompurify": "^3.1.3",
"dompurify": "^3.1.5",
"email-templates": "^11.1.1",
"express": "^4.19.2",
"express-rate-limit": "^7.2.0",
"express-async-errors": "^3.1.1",
"express-rate-limit": "^7.3.1",
"https-proxy-agent": "^7.0.4",
"ical.js": "^2.0.1",
"ics": "^3.7.2",
"jsdom": "^24.0.0",
"ics": "^3.7.6",
"jsdom": "^24.1.0",
"leaflet": "^1.9.4",
"linkify-html": "^4.1.3",
"linkifyjs": "4.1.3",
"lodash": "^4.17.21",
"luxon": "^3.4.4",
"mariadb": "2",
"mariadb": "^2.5.6",
"memory-cache": "^0.2.0",
"microformat-node": "^2.0.4",
"minify-css-string": "^1.0.0",
@ -79,15 +80,15 @@
"passport-http-bearer": "^1.0.1",
"passport-oauth2-client-password": "^0.1.2",
"passport-oauth2-client-public": "^0.0.1",
"pg": "^8.11.5",
"pg": "^8.12.0",
"semver": "^7.6.2",
"sequelize": "^6.37.3",
"sequelize-slugify": "^1.6.2",
"sharp": "^0.27.2",
"sqlite3": "^5.1.7",
"telegraf": "^4.16.3",
"tiptap": "^1.32.0",
"tiptap-extensions": "^1.35.0",
"tiptap": "^1.32.2",
"tiptap-extensions": "^1.35.2",
"umzug": "^2.3.0",
"v-calendar": "^2.4.2",
"vue2-leaflet": "^2.7.1",
@ -102,12 +103,12 @@
"jest": "^29.7.0",
"jest-environment-node": "^29.7.0",
"prettier": "^2.8.8",
"pug": "^3.0.2",
"pug": "^3.0.3",
"pug-plain-loader": "^1.1.0",
"sass": "^1.67.0",
"sequelize-cli": "^6.6.1",
"sass": "^1.77.6",
"sequelize-cli": "^6.6.2",
"supertest": "^6.3.4",
"webpack": "4",
"webpack": "^4.47.0",
"webpack-cli": "^4.10.0"
},
"resolutions": {

View file

@ -337,7 +337,7 @@ module.exports = {
}
},
async isGeocodingEnabled(req, res, next) {
isGeocodingEnabled(req, res, next) {
if (res.locals.settings.allow_geolocation) {
next()
} else {

View file

@ -1,4 +1,5 @@
const express = require('express')
require('express-async-errors')
const app = express()
const initialize = require('./initialize.server')
@ -66,8 +67,8 @@ async function main () {
// // Handle 500
app.use((error, _req, res, _next) => {
log.error('[ERROR]' + error)
return res.status(500).send('500: Internal Server Error')
log.error('[ERROR] %s', error)
return res.sendStatus(500) //.send('500: Internal Server Error')
})
// remaining request goes to nuxt