@@ -11,6 +11,7 @@ import {
1111 log ,
1212} from "./constants.js" ;
1313import { shouldMirrorRefreshedOAuthCredential } from "./oauth-identity.js" ;
14+ import { OAuthRefreshFailureError } from "./oauth-refresh-failure.js" ;
1415import {
1516 buildRefreshContentionError ,
1617 isGlobalRefreshLockTimeoutError ,
@@ -61,9 +62,8 @@ export type ResolvedOAuthAccess = {
6162 credential : OAuthCredential ;
6263} ;
6364
64- export class OAuthManagerRefreshError extends Error {
65+ export class OAuthManagerRefreshError extends OAuthRefreshFailureError {
6566 readonly profileId : string ;
66- readonly provider : string ;
6767 readonly code ?: string ;
6868 readonly lockPath ?: string ;
6969 readonly #refreshedStore: AuthProfileStore ;
@@ -91,13 +91,14 @@ export class OAuthManagerRefreshError extends Error {
9191 storedCredential ?. type === "oauth" ? storedCredential : undefined ,
9292 ) ;
9393 const causeMessage = formatRedactedOAuthRefreshError ( params . cause , secrets ) ;
94- super ( `OAuth token refresh failed for ${ params . credential . provider } : ${ causeMessage } ` , {
94+ super ( {
95+ provider : params . credential . provider ,
96+ message : `OAuth token refresh failed for ${ params . credential . provider } : ${ causeMessage } ` ,
9597 cause : createRedactedOAuthRefreshCause ( delegatedCause , secrets ) ,
9698 } ) ;
9799 this . name = "OAuthManagerRefreshError" ;
98100 this . #credential = params . credential ;
99101 this . profileId = params . profileId ;
100- this . provider = params . credential . provider ;
101102 this . #refreshedStore = params . refreshedStore ;
102103 if ( structuredCause ) {
103104 this . code = typeof structuredCause . code === "string" ? structuredCause . code : undefined ;
0 commit comments