Skip to content

Commit

Permalink
fix: add pretty print format for errors in debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
hperrin committed Aug 4, 2022
1 parent 869f31d commit 7f315c1
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Methods/COPY.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export class COPY extends Method {
},
async (code, message, error) => {
if (code === 500 && error) {
response.locals.debug('Unknown Error: ', error);
response.locals.debug('Unknown Error: %o', error);
}

let status = new Status(destination, code);
Expand Down
2 changes: 1 addition & 1 deletion src/Methods/DELETE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class DELETE extends Method {
},
async (code, message, error) => {
if (code === 500 && error) {
response.locals.debug('Unknown Error: ', error);
response.locals.debug('Unknown Error: %o', error);
}

const url = await child.getCanonicalUrl(
Expand Down
4 changes: 2 additions & 2 deletions src/Methods/LOCK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export class LOCK extends Method {
},
async (code, message, error) => {
if (code === 500 && error) {
response.locals.debug('Unknown Error: ', error);
response.locals.debug('Unknown Error: %o', error);
}

const url = await child.getCanonicalUrl(
Expand Down Expand Up @@ -392,7 +392,7 @@ export class LOCK extends Method {
},
async (code, message, error) => {
if (code === 500 && error) {
response.locals.debug('Unknown Error: ', error);
response.locals.debug('Unknown Error: %o', error);
}

const url = await child.getCanonicalUrl(
Expand Down
2 changes: 1 addition & 1 deletion src/Methods/MOVE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export class MOVE extends Method {
},
async (code, message, error) => {
if (code === 500 && error) {
response.locals.debug('Unknown Error: ', error);
response.locals.debug('Unknown Error: %o', error);
}

let status = new Status(destination, code);
Expand Down
2 changes: 1 addition & 1 deletion src/Methods/PROPPATCH.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class PROPPATCH extends Method {
},
async (code, message, error) => {
if (code === 500 && error) {
response.locals.debug('Unknown Error: ', error);
response.locals.debug('Unknown Error: %o', error);
}

const propStatStatus = new PropStatStatus(code);
Expand Down
2 changes: 1 addition & 1 deletion src/Options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const defaults: Options = {
}

if (code === 500 && error) {
response.locals.debug('Unknown Error: ', error);
response.locals.debug('Unknown Error: %o', error);
}

if (response.destroyed) {
Expand Down
4 changes: 2 additions & 2 deletions src/createServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default function createServer(
return;
}

response.locals.debug('Error: ', e);
response.locals.debug('Error: %o', e);
response.status(500);
opts.errorHandler(500, 'Internal server error.', request, response, e);
return;
Expand All @@ -142,7 +142,7 @@ export default function createServer(
try {
await adapter.cleanAuthentication(request, response);
} catch (e: any) {
response.locals.debug('Error during authentication cleanup: ', e);
response.locals.debug('Error during authentication cleanup: %o', e);
}
});
next();
Expand Down

0 comments on commit 7f315c1

Please sign in to comment.