🐛 Fixed throwing errors during link redirects
no issue Errors weren't correctly passed on to Express in the middleware.
This commit is contained in:
parent
3b6759ca6d
commit
4436a1cd18
@ -85,6 +85,7 @@ class LinkRedirectsService {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async handleRequest(req, res, next) {
|
||||
try {
|
||||
// skip handling if original url doesn't match the prefix
|
||||
const fullURLWithRedirectPrefix = `${this.#baseURL.pathname}${this.#redirectURLPrefix}`;
|
||||
// @NOTE: below is equivalent to doing:
|
||||
@ -113,6 +114,9 @@ class LinkRedirectsService {
|
||||
|
||||
res.setHeader('X-Robots-Tag', 'noindex, nofollow');
|
||||
return res.redirect(link.to.href);
|
||||
} catch (e) {
|
||||
return next(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user