Project

General

Profile

Actions

Bug #123

open

refactor exceptions to avoid superfluous message attribute

Added by Sam Pearson 4 months ago. Updated 23 days ago.

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.


Related issues 1 (1 open0 closed)

Related to Task #131: unify 404 handlingNew04/06/2026

Actions
Actions

Also available in: Atom PDF