Skip to content

Commit

Permalink
When an error occurs, only log relevant info, not the entire request …
Browse files Browse the repository at this point in the history
…object
  • Loading branch information
n4bb12 committed Sep 19, 2023
1 parent dc61789 commit 98db8f8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/github-oauth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios from "axios"
import axios, { AxiosError } from "axios"
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify"
import { nanoid } from "nanoid"
import { URLSearchParams } from "url"
Expand Down Expand Up @@ -233,7 +233,11 @@ export function registerGitHubOAuth(server: FastifyInstance, config: Config) {

return succeed(res, user, state.path)
} catch (error) {
console.error(error)
if (error instanceof AxiosError) {
console.error(error.toJSON())
} else if (error instanceof Error) {
console.error(error.stack)
}
return res.redirect(302, urls.localGenericError)
}
})
Expand Down

0 comments on commit 98db8f8

Please sign in to comment.