Skip to content

Commit

Permalink
Be a little more truthfull when telling users that something failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Haarhoff committed Jun 5, 2024
1 parent 4807e2e commit 55f35ae
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/http/query-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import {Request, Response} from 'express';
import {getUserFromSession} from '../authentication';
import {failureWithStatus} from '../types/failureWithStatus';
import {StatusCodes} from 'http-status-codes';
import {logInPath} from '../authentication/auth-routes';
import {User} from '../types';
import {pageTemplate} from '../templates';
import {oopsPage, pageTemplate} from '../templates';
import {Params, Query} from '../queries/query';

const buildPage =
Expand All @@ -28,7 +27,7 @@ export const queryGet =
),
TE.chain(buildPage(deps, req.params, query)),
TE.matchW(
() => res.redirect(logInPath),
failure => res.status(failure.status).send(oopsPage(failure.message)),
page => res.status(200).send(page)
)
)();
Expand Down

0 comments on commit 55f35ae

Please sign in to comment.