Update web-page handler: add more detailed error logs

This commit is contained in:
Benjamin Toby 2026-03-22 10:56:48 +01:00
parent 3d044ee79e
commit 49d6781170
7 changed files with 8 additions and 8 deletions

View File

@ -28,7 +28,7 @@ export default async function handleWebPages({ req, }) {
});
}
catch (error) {
log.error(`Error Handling Web Page: ${error.message}`);
log.error(`Error Handling Web Page: ${error.message}`, error);
const componentRes = await grabPageErrorComponent({
error,
});

2
dist/index.d.ts vendored
View File

@ -5,7 +5,7 @@ declare const bunext: {
bunextLog: {
info: (msg: string, log?: any) => void;
success: (msg: string, log?: any) => void;
error: (msg: string | Error) => void;
error: (msg: string | Error, log?: any) => void;
warn: (msg: string) => void;
build: (msg: string) => void;
watch: (msg: string) => void;

2
dist/utils/log.d.ts vendored
View File

@ -1,7 +1,7 @@
export declare const log: {
info: (msg: string, log?: any) => void;
success: (msg: string, log?: any) => void;
error: (msg: string | Error) => void;
error: (msg: string | Error, log?: any) => void;
warn: (msg: string) => void;
build: (msg: string) => void;
watch: (msg: string) => void;

2
dist/utils/log.js vendored
View File

@ -15,7 +15,7 @@ export const log = {
success: (msg, log) => {
console.log(`${prefix.success} ${chalk.green(msg)}`, log || "");
},
error: (msg) => console.error(`${prefix.error} ${chalk.red(String(msg))}`),
error: (msg, log) => console.error(`${prefix.error} ${chalk.red(String(msg))}`, log || ""),
warn: (msg) => console.warn(`${prefix.warn} ${chalk.yellow(msg)}`),
build: (msg) => console.log(`${prefix.build} ${chalk.magenta(msg)}`),
watch: (msg) => console.log(`${prefix.watch} ${chalk.blue(msg)}`),

View File

@ -2,7 +2,7 @@
"name": "@moduletrace/bunext",
"module": "index.ts",
"type": "module",
"version": "1.0.11",
"version": "1.0.12",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {

View File

@ -39,7 +39,7 @@ export default async function handleWebPages({
...componentRes,
});
} catch (error: any) {
log.error(`Error Handling Web Page: ${error.message}`);
log.error(`Error Handling Web Page: ${error.message}`, error);
const componentRes = await grabPageErrorComponent({
error,

View File

@ -17,8 +17,8 @@ export const log = {
success: (msg: string, log?: any) => {
console.log(`${prefix.success} ${chalk.green(msg)}`, log || "");
},
error: (msg: string | Error) =>
console.error(`${prefix.error} ${chalk.red(String(msg))}`),
error: (msg: string | Error, log?: any) =>
console.error(`${prefix.error} ${chalk.red(String(msg))}`, log || ""),
warn: (msg: string) => console.warn(`${prefix.warn} ${chalk.yellow(msg)}`),
build: (msg: string) =>
console.log(`${prefix.build} ${chalk.magenta(msg)}`),