File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -789,6 +789,20 @@ export const getUserPermissionsForServerRepo = async (
789789export const isBitbucketServerUserAuthenticated = async (
790790 client : BitbucketClient ,
791791) : Promise < boolean > => {
792- const { error } = await client . apiClient . GET ( `/rest/api/1.0/profile/recent/repos` as ServerGetRequestPath , { } ) ;
793- return ! error ;
792+ try {
793+ const { error, response } = await client . apiClient . GET ( `/rest/api/1.0/profile/recent/repos` as ServerGetRequestPath , { } ) ;
794+ if ( error ) {
795+ if ( response . status === 401 || response . status === 403 ) {
796+ return false ;
797+ }
798+ throw new Error ( `Unexpected error when verifying Bitbucket Server authentication status: ${ JSON . stringify ( error ) } ` ) ;
799+ }
800+ return true ;
801+ } catch ( e : any ) {
802+ // Handle the case where openapi-fetch throws directly for auth errors
803+ if ( e ?. status === 401 || e ?. status === 403 ) {
804+ return false ;
805+ }
806+ throw e ;
807+ }
794808} ;
You can’t perform that action at this time.
0 commit comments