Skip to content

refactor(error-handling): tighten 17 bare except Exception sites with typed handling - #161

Merged
usmanimamu17-create merged 2 commits into
ApexChainx:mainfrom
peaceshallom37-rgb:fix/93-tighten-exception-handling
Jul 30, 2026
Merged

refactor(error-handling): tighten 17 bare except Exception sites with typed handling#161
usmanimamu17-create merged 2 commits into
ApexChainx:mainfrom
peaceshallom37-rgb:fix/93-tighten-exception-handling

Conversation

@peaceshallom37-rgb

Copy link
Copy Markdown
Contributor

Description

  • Adds ApexException base class, ApexNotFoundError, ApexTransientError to exception hierarchy
  • Makes ApexConflictError and ApexValidationError inherit from ApexException
  • Fixes bare except Exception in 8 files: webhook_tasks.py, sla_tasks.py, jobs.py, outages.py, sla_service.py, lock.py, correlation.py
  • Each site now uses ApexException subclasses or specific Python types with logger.exception() for context

Type of Change

  • Refactoring

Related Issue

Closes #93

Files Changed

  • app/core/exceptions.py — exception hierarchy
  • app/tasks/webhook_tasks.py, sla_tasks.py — Celery task typed errors
  • app/api/v1/endpoints/jobs.py, outages.py — API endpoint typed errors
  • app/services/sla_service.py — SLA computation typed errors
  • app/core/lock.py — advisory lock typed errors
  • app/middleware/correlation.py — correlation middleware typed errors

Checklist

  • Code follows style guidelines
  • Self-review completed

… typed handling

- Add ApexException base class, ApexNotFoundError, ApexTransientError
- Make ApexConflictError and ApexValidationError inherit from ApexException
- Fix bare except Exception in webhook_tasks.py, sla_tasks.py, jobs.py,
  outages.py, sla_service.py, lock.py, correlation.py
- Each site now uses ApexException subclasses or specific Python types
- logger.exception() added for incident context

Closes ApexChainx#93
@usmanimamu17-create

Copy link
Copy Markdown
Contributor

@peaceshallom37-rgb resolve conflicts please

@usmanimamu17-create

Copy link
Copy Markdown
Contributor

@peaceshallom37-rgb resolve conflicts

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@peaceshallom37-rgb Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Comment thread app/core/lock.py
except ApexTransientError:
raise # let domain errors propagate
except Exception as exc:
logger.exception("Error inside advisory lock (nowait) for '%s'", lock_key)
@usmanimamu17-create
usmanimamu17-create merged commit 7d11aea into ApexChainx:main Jul 30, 2026
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tighten 17 bare except Exception sites with typed handling

3 participants