-
Notifications
You must be signed in to change notification settings - Fork 432
chore: remove unnecessary error logs #2179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,6 @@ import { AbstractSessionStore } from "./session/abstract-session-store.js"; | |
import { TransactionState, TransactionStore } from "./transaction-store.js"; | ||
import { filterDefaultIdTokenClaims } from "./user.js"; | ||
|
||
|
||
export type BeforeSessionSavedHook = ( | ||
session: SessionData, | ||
idToken: string | null | ||
|
@@ -733,7 +732,6 @@ export class AuthClient { | |
await this.discoverAuthorizationServerMetadata(); | ||
|
||
if (discoveryError) { | ||
console.error(discoveryError); | ||
return [discoveryError, null]; | ||
} | ||
|
||
|
@@ -757,11 +755,14 @@ export class AuthClient { | |
refreshTokenRes | ||
); | ||
} catch (e: any) { | ||
console.error(e); | ||
return [ | ||
new AccessTokenError( | ||
AccessTokenErrorCode.FAILED_TO_REFRESH_TOKEN, | ||
"The access token has expired and there was an error while trying to refresh it. Check the server logs for more information." | ||
"The access token has expired and there was an error while trying to refresh it.", | ||
new OAuth2Error({ | ||
code: e.error, | ||
message: e.error_description | ||
}) | ||
Comment on lines
+761
to
+765
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than logging the error, the cause is added to the error that is returned to the caller. At that point they can handle the error and choose to log or not. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still feel like it's unfortunate that we lose track of the entire stack trace, is there a way we can retain that? Typically, the cause is set to the original error: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause |
||
), | ||
null | ||
]; | ||
|
@@ -815,7 +816,7 @@ export class AuthClient { | |
return [null, authorizationServerMetadata]; | ||
} catch (e) { | ||
console.error( | ||
`An error occured while performing the discovery request. Please make sure the AUTH0_DOMAIN environment variable is correctly configured — the format must be 'example.us.auth0.com'. issuer=${issuer.toString()}, error:`, | ||
`An error occured while performing the discovery request. issuer=${issuer.toString()}, error:`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should rarely show up (e.g.: outages or misconfigurations) so I opted to keep this log in to provide some visibility since the errors are not always available for a caller to handler programmatically. |
||
e | ||
); | ||
return [ | ||
|
@@ -1106,7 +1107,6 @@ export class AuthClient { | |
await this.discoverAuthorizationServerMetadata(); | ||
|
||
if (discoveryError) { | ||
console.error(discoveryError); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was a redundant log since we already log an error in |
||
return [discoveryError, null]; | ||
} | ||
|
||
|
@@ -1130,11 +1130,10 @@ export class AuthClient { | |
httpResponse | ||
); | ||
} catch (err: any) { | ||
console.error(err); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are already returning the |
||
return [ | ||
new AccessTokenForConnectionError( | ||
AccessTokenForConnectionErrorCode.FAILED_TO_EXCHANGE, | ||
"There was an error trying to exchange the refresh token for a connection access token. Check the server logs for more information.", | ||
"There was an error trying to exchange the refresh token for a connection access token.", | ||
new OAuth2Error({ | ||
code: err.error, | ||
message: err.error_description | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a redundant log since we already log an error in
discoverAuthorizationServerMetadata
.