Skip to content

Commit

Permalink
removed sqlite3 dependency and related exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
feyruzb committed Feb 3, 2025
1 parent 3f4a491 commit e858a49
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions web/server/codechecker_server/api/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"""

import datetime
import sqlite3

from authlib.integrations.requests_client import OAuth2Session
from authlib.common.security import generate_token
Expand Down Expand Up @@ -164,8 +163,10 @@ def insertDataOauth(self, state, code_verifier, provider):
"< DATETIME(\"" + date + "\")")
session.commit()
LOG.info("Expired state, validation codes removed successfully.")
except sqlite3.Error as e:
LOG.error(f"An error occurred: {e}")
except Exception as ex:
raise codechecker_api_shared.ttypes.RequestFailed(
codechecker_api_shared.ttypes.ErrorCode.AUTH_DENIED,
"OAuth data insertion failed. Please try again.")

# Insert the state code into the database
try:
Expand All @@ -182,12 +183,10 @@ def insertDataOauth(self, state, code_verifier, provider):
session.commit()

LOG.info("State inserted successfully.")

except sqlite3.Error as e:
LOG.error(f"An error occurred: {e}")
raise codechecker_api_shared.ttypes.RequestFailed(
codechecker_api_shared.ttypes.ErrorCode.AUTH_DENIED,
"OAuth data insertion failed. Please try again.")
except Exception as ex:
raise codechecker_api_shared.ttypes.RequestFailed(
codechecker_api_shared.ttypes.ErrorCode.AUTH_DENIED,
"OAuth data insertion failed. Please try again.")

@timeit
def getOauthProviders(self):
Expand Down

0 comments on commit e858a49

Please sign in to comment.