fix(error): add trace to browser in dev mode

also make AppError a bit easier to use
This commit is contained in:
zyachel
2025-06-01 13:03:08 +00:00
committed by ngn
parent bde980536d
commit ac60bda3bd
7 changed files with 83 additions and 35 deletions

View File

@ -67,13 +67,13 @@ export const getServerSideProps: GetServerSideProps<Data, FindQueryParams> = asy
props: { data: { title: query, results: res }, error: null, originalPath },
};
} catch (error) {
const { message, statusCode } = getErrorProperties(error);
ctx.res.statusCode = statusCode;
ctx.res.statusMessage = message;
const err = getErrorProperties(error);
ctx.res.statusCode = err.statusCode;
ctx.res.statusMessage = err.message;
return {
props: {
error: { message, statusCode },
error: { message: err.message, statusCode: err.statusCode, stack: err.format() },
data: { title: query, results: null },
originalPath,
},