diff --git a/daras_ai_v2/onedrive_downloader.py b/daras_ai_v2/onedrive_downloader.py index b72aa1267..a70f4e8e6 100644 --- a/daras_ai_v2/onedrive_downloader.py +++ b/daras_ai_v2/onedrive_downloader.py @@ -64,7 +64,7 @@ def onedrive_meta( return metadata except requests.exceptions.HTTPError as e: - if e.status_code == 401 and retries > 0: + if r.status_code == 401 and retries > 0: try: current_workspace.onedrive_access_token = ( get_access_token_from_refresh_token( @@ -78,5 +78,10 @@ def onedrive_meta( ) except Exception: raise OneDriveAuth(generate_onedrive_auth_url(current_app_url)) + + elif r.status_code == 403: + raise UserError( + "make sure the document is accessible from loggedin microsoft account" + ) else: raise e