Actions
Bug #123
openrefactor exceptions to avoid superfluous message attribute
Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
03/26/2026
Due date:
% Done:
0%
Estimated time:
Engineering Effort:
medium
App Component:
Database
Feature:
Description
We have a bunch of exceptions that make use of a superfluous "message" attribute:
class TaskValidationError(ValidationError):
def __init__(self, message: str):
self.message = message
super().__init__(message)
This is unnecessary. Exceptions store their message in arg[0] and you can just do str(e) to fetch them.
You can just do this:
raise ValidationError(f"Remote calendar {remote_uid} not found.")
And then later:
return jsonify({"error": str(e)}), 401
We should replace all instances of e.message with str(e), and then remove the class definition for exceptions entirely (unless some of them have something other than saving a "message" attribute.
Updated by Sam Pearson 4 months ago
- Subject changed from refactor exceptions to refactor exceptions to avoid superfluous message attribute
Updated by Sam Pearson 3 months ago
- Related to Task #131: unify 404 handling added
Updated by Sam Pearson 3 months ago
- Related to deleted (Task #131: unify 404 handling)
Updated by Sam Pearson 3 months ago
- Related to Task #131: unify 404 handling added
Updated by Sam Pearson 23 days ago
- Engineering Effort set to medium
- App Component set to Database
Changing the exceptions themselves should be pretty simple but then all the places where they're used also need to be refactored. But the refactoring should be simple, it's a simple object, so probably medium eng effort?
Actions