Skip to content

Commit

Permalink
better console msg (#134)
Browse files Browse the repository at this point in the history
More detailed console msg for active console exeptions
  • Loading branch information
Trivinyx authored Apr 26, 2024
1 parent 967a837 commit 6b3aa2e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions backend/img2mapAPI/utils/storage/data/postgresSqlHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async def saveInStorage(self, data: BaseModel, type: str, pkName:str = 'id')->in
id = cur.fetchone()[0]
return id
except Exception as e:
print(e)
print(f"Error Accured in:{str(self.__name__)} :: Error {e}")
pass
finally:
cur.close()
Expand All @@ -79,7 +79,7 @@ async def saveInStorage(self, data: BaseModel, type: str, pkName:str = 'id')->in
id = cur.fetchone()[0]
return id
except Exception as e:
print(e)
print(f"Error Accured in:{str(self.__name__)} :: Error {e}")
pass
finally:
cur.close()
Expand Down Expand Up @@ -107,7 +107,7 @@ async def remove(self, id: int, type: str)->None:
)
conn.commit()
except Exception as e:
print(e)
print(f"Error Accured in:{str(self.__name__)} :: Error {e}")
pass
finally:
cur.close()
Expand Down Expand Up @@ -136,7 +136,7 @@ async def update(self, id: int, data: BaseModel, type: str)->None:
print(f"Updated project with id {data.id}") #Todo: log this
conn.commit()
except Exception as e:
print(e)
print(f"Error Accured in:{str(self.__name__)} :: Error {e}")
pass
finally:
cur.close()
Expand All @@ -149,7 +149,7 @@ async def update(self, id: int, data: BaseModel, type: str)->None:
)
conn.commit()
except Exception as e:
print(e)
print(f"Error Accured in:{str(self.__name__)} :: Error {e}")
pass
finally:
cur.close()
Expand Down Expand Up @@ -223,7 +223,7 @@ async def fetch(self, type: str, params: dict = {})->Union[None ,list, dict]:
return [self.convertSequenseToDict(row, type) for row in data]
return data
except Exception as e:
print(e)
print(f"Error Accured in:{str(self.__name__)} :: Error {e}")
raise e

async def fetchAll(self, type: str) ->Union[None, list]:
Expand All @@ -248,7 +248,7 @@ async def fetchAll(self, type: str) ->Union[None, list]:
data = cur.fetchall()
return data
except Exception as e:
print(e)
print(f"Error Accured in:{str(self.__name__)} :: Error {e}")
raise e


Expand Down Expand Up @@ -286,7 +286,7 @@ async def createModelTable(self):
try:
await createTable(self.dnsString, project_table)
except Exception as e:
print(e)
print(f"Error Accured in:{str(self.__name__)} :: Error {e}")
pass #Todo: handle exception

points_table = '''CREATE TABLE IF NOT EXISTS point (
Expand All @@ -308,7 +308,7 @@ async def createModelTable(self):
try:
await createTable(self.dnsString, points_table)
except Exception as e:
print(e)
print(f"Error Accured in:{str(self.__name__)} :: Error {e}")
pass #Todo: handle exception

def convertSequenseToDict(self, row: tuple, type: str)->dict:
Expand Down Expand Up @@ -358,7 +358,7 @@ async def setup(self):
await self.createModelTable()
self.doneSetup = True
except Exception as e:
print(e)
print(f"Error Accured in:{str(self.__name__)} :: Error {e}")
pass

def __init__(self, dnsString: str):
Expand Down

0 comments on commit 6b3aa2e

Please sign in to comment.