Skip to content

Commit 98db8f8

Browse files
committed
When an error occurs, only log relevant info, not the entire request object
1 parent dc61789 commit 98db8f8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/github-oauth.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import axios from "axios"
1+
import axios, { AxiosError } from "axios"
22
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify"
33
import { nanoid } from "nanoid"
44
import { URLSearchParams } from "url"
@@ -233,7 +233,11 @@ export function registerGitHubOAuth(server: FastifyInstance, config: Config) {
233233

234234
return succeed(res, user, state.path)
235235
} catch (error) {
236-
console.error(error)
236+
if (error instanceof AxiosError) {
237+
console.error(error.toJSON())
238+
} else if (error instanceof Error) {
239+
console.error(error.stack)
240+
}
237241
return res.redirect(302, urls.localGenericError)
238242
}
239243
})

0 commit comments

Comments
 (0)