errors: Rename PlinthError to FbxError

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2026-08-17 20:36:33 -07:00 committed by James Valleroy
parent d144dce428
commit 7a88c46bb2
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
5 changed files with 14 additions and 14 deletions

View File

@ -4,22 +4,22 @@ Project specific errors
""" """
class PlinthError(Exception): class FbxError(Exception):
"""Base class for all FreedomBox specific errors.""" """Base class for all FreedomBox specific errors."""
class PackageNotInstalledError(PlinthError): class PackageNotInstalledError(FbxError):
"""Could not complete module setup due to missing package.""" """Could not complete module setup due to missing package."""
class DomainNotRegisteredError(PlinthError): class DomainNotRegisteredError(FbxError):
""" """
An action couldn't be performed because this An action couldn't be performed because this
FreedomBox doesn't have a registered domain FreedomBox doesn't have a registered domain
""" """
class MissingPackageError(PlinthError): class MissingPackageError(FbxError):
"""Package is not available to be installed at this time.""" """Package is not available to be installed at this time."""
def __init__(self, name): def __init__(self, name):

View File

@ -2,10 +2,10 @@
import subprocess import subprocess
from freedombox.errors import PlinthError from freedombox.errors import FbxError
class BorgError(PlinthError): class BorgError(FbxError):
"""Generic borg errors.""" """Generic borg errors."""
@ -17,7 +17,7 @@ class SshError(subprocess.CalledProcessError):
"""Error when running an SSH command.""" """Error when running an SSH command."""
class SshfsError(PlinthError): class SshfsError(FbxError):
"""Generic sshfs errors.""" """Generic sshfs errors."""

View File

@ -19,7 +19,7 @@ from django.utils.translation import gettext_lazy
from django.views.decorators.http import require_POST from django.views.decorators.http import require_POST
from django.views.generic import FormView, TemplateView, View from django.views.generic import FormView, TemplateView, View
from freedombox.errors import PlinthError from freedombox.errors import FbxError
from freedombox.modules import backups, storage from freedombox.modules import backups, storage
from freedombox.views import AppView from freedombox.views import AppView
@ -201,7 +201,7 @@ class UploadArchiveView(FormView):
context['title'] = _('Upload and restore a backup') context['title'] = _('Upload and restore a backup')
try: try:
mount_info = storage.get_mount_info('/') mount_info = storage.get_mount_info('/')
except PlinthError as exception: except FbxError as exception:
logger.exception( logger.exception(
'Error getting information about root partition: %s', 'Error getting information about root partition: %s',
exception) exception)

View File

@ -16,7 +16,7 @@ from django.views.generic.edit import FormView
from freedombox import app as app_module from freedombox import app as app_module
from freedombox import views from freedombox import views
from freedombox.errors import PlinthError from freedombox.errors import FbxError
from freedombox.modules import storage from freedombox.modules import storage
from freedombox.modules.kiwix import privileged from freedombox.modules.kiwix import privileged
from freedombox.views import messages_error from freedombox.views import messages_error
@ -56,7 +56,7 @@ class AddPackageView(SuccessMessageMixin, FormView):
# TODO The following is almost duplicated in backups/views.py # TODO The following is almost duplicated in backups/views.py
try: try:
mount_info = storage.get_mount_info('/') mount_info = storage.get_mount_info('/')
except PlinthError as exception: except FbxError as exception:
logger.exception( logger.exception(
'Error getting information about root partition: %s', 'Error getting information about root partition: %s',
exception) exception)

View File

@ -12,7 +12,7 @@ from django.utils.translation import gettext_noop
from freedombox import app as app_module from freedombox import app as app_module
from freedombox import cfg, glib, menu from freedombox import cfg, glib, menu
from freedombox.diagnostic_check import DiagnosticCheck, Result from freedombox.diagnostic_check import DiagnosticCheck, Result
from freedombox.errors import PlinthError from freedombox.errors import FbxError
from freedombox.modules.backups.components import BackupRestore from freedombox.modules.backups.components import BackupRestore
from freedombox.package import Packages from freedombox.package import Packages
from freedombox.utils import format_lazy from freedombox.utils import format_lazy
@ -186,7 +186,7 @@ def get_mount_info(mount_point):
mount for mount in mounts if mount_point == mount['mount_point'] mount for mount in mounts if mount_point == mount['mount_point']
] ]
if not list_root: if not list_root:
raise PlinthError('Mount point {} not found.'.format(mount_point)) raise FbxError('Mount point {} not found.'.format(mount_point))
percent_used = list_root[0]['percent_used'] percent_used = list_root[0]['percent_used']
free_bytes = list_root[0]['free'] free_bytes = list_root[0]['free']
@ -292,7 +292,7 @@ def warn_about_low_disk_space(_data):
try: try:
root_info = get_mount_info('/') root_info = get_mount_info('/')
except PlinthError: except FbxError:
return return
show = False show = False