Skip to content

Commit 3f91c75

Browse files
committed
revert exception changes
1 parent 9969c8e commit 3f91c75

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

  • samples/web-app-sql-database/python/src

samples/web-app-sql-database/python/src/app.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ def read_activities_from_db(username: str | None = None) -> List[Tuple[str, str]
5353
for activity in activity_list:
5454
result.append((activity["id"], activity["activity"]))
5555
except (ConnectionError, ValueError, KeyError) as e:
56-
logger.error("Expected error reading activities: %s", e)
57-
except Exception as e:
58-
logger.error("Unexpected system error reading activities: %s", e)
56+
logger.error("Error reading activities: %s", e)
5957
return result
6058

6159
@app.route('/', methods=['GET', 'POST'])
@@ -91,9 +89,7 @@ def index():
9189
activities.append((inserted_activity["id"], inserted_activity["activity"]))
9290
logger.info(f"Activity created: {inserted_activity['id']}")
9391
except (ConnectionError, ValueError) as e:
94-
logger.error("Expected error creating/updating activity: %s", e)
95-
except Exception as e:
96-
logger.error("Unexpected system error creating/updating activity: %s", e)
92+
logger.error("Error creating/updating activity: %s", e)
9793

9894
return redirect(url_for('index'))
9995

@@ -122,9 +118,7 @@ def delete(activity_id: int):
122118
else:
123119
logger.warning(f"No activity found with ID: {db_activity_id}")
124120
except (ConnectionError, ValueError) as e:
125-
logger.error("Expected error deleting activity: %s", e)
126-
except Exception as e:
127-
logger.error("Unexpected system error deleting activity: %s", e)
121+
logger.error("Error deleting activity: %s", e)
128122

129123
return redirect(url_for('index'))
130124

@@ -138,9 +132,7 @@ def update(activity_id: int):
138132
# Redirect to index with edit parameters
139133
return redirect(url_for('index', edit_id=db_activity_id, edit_activity=activity_text))
140134
except (ConnectionError, ValueError) as e:
141-
logger.error("Expected error preparing activity for update: %s", e)
142-
except Exception as e:
143-
logger.error("Unexpected system error preparing activity for update: %s", e)
135+
logger.error("Error preparing activity for update: %s", e)
144136

145137
return redirect(url_for('index'))
146138

0 commit comments

Comments
 (0)