Closed
Conversation
Agent-Logs-Url: https://github.com/ait-detectmate/DetectMateLibrary/sessions/b5c3b31d-5b40-4d75-b25f-9ca9a5433f97 Co-authored-by: viktorbeck98 <95294548+viktorbeck98@users.noreply.github.com>
Collaborator
|
@ipmach what do you think? |
Copilot
AI
changed the title
[WIP] Throw meaningful exceptions in run method
Throw meaningful exceptions in run()
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task
Closes #[issue] — bare exceptions from
detect()/parse()/run()propagated to the service as a genericException, making it impossible to distinguish library errors from unrelated failures.Description
Introduces a typed exception hierarchy and wraps all unhandled exceptions raised inside component lifecycle methods so callers can catch and handle them with context.
New
src/detectmatelibrary/exceptions.py:All exceptions are exported from
detectmatelibraryanddetectmatelibrary.common.Wrapping points:
CoreDetector.run()— wrapsself.detect()→DetectorRunErrorCoreParser.run()— wrapsself.parse()→ParserRunErrorCoreComponent.process()— wrapsself.run()→ComponentRunErrorfor anything not already aDetectMateError(preserves the specific subclass from the inner layers)Every wrapped exception carries the original as
__cause__(full traceback preserved) and embeds the component name in the message.Service-side usage:
test_bad_players.pyupdated:test_get_incorrect_schemanow expectsComponentRunError(withFieldNotFoundas__cause__) — this reflects the intentional new behaviour where schema-layer errors are also surfaced as typed library exceptions.How Has This Been Tested?
17 new tests in
tests/test_common/test_exceptions.pycovering:issubclassassertions)ComponentRunError,DetectorRunError,ParserRunErrorwrapping viaprocess()__cause__preservation of the original exceptionComponentRunError,DetectMateError)Full suite (347 tests) passes.
Checklist
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
openaipublic.blob.core.windows.net/usr/bin/python3 python3 -m pytest -q(dns block)/usr/bin/python3 python3 -m pytest -q 3c49��(dns block)If you need me to access, download, or install something from one of these locations, you can either: