fix: validate dynamic method calls in ProcessHandler and TaskHandler (#153)#174
fix: validate dynamic method calls in ProcessHandler and TaskHandler (#153)#174
Conversation
Code Review1. Validation exceptions thrown outside try-catch (Medium)The new validation logic in both
The goal of #153 is to prevent worker crashes, but this implementation may still crash the worker — just with a different exception type. Two possible fixes:
2. Missing tests (Medium)New validation paths lack test coverage for:
3. Duplicated validation logic (Low)The same |
Extract shared validation into ServiceMethodHelper and move method existence check inside try-catch for graceful error handling. ProcessHandler and TaskHandler now: - Validate service method format (serviceId::methodName) via shared helper - Check method_exists() inside try-catch, dispatching error events instead of crashing the worker - Gracefully handle runtime exceptions from the service method Adds unit tests for: - ServiceMethodHelper (valid/invalid formats) - ProcessHandler (success, missing method, runtime error, invalid format) - TaskHandler (success, missing method, runtime error, invalid format) Closes #153
87fb693 to
5b95e15
Compare
|
@s2x Dzięki za review! Wszystkie 3 uwagi są poprawione: 1. Walidacja w try-catch
Walidacja formatu ( 2. TestyDodane 22 testy:
3. Wydzielona logikaUtworzony |
Summary
Fix #153 — ProcessHandler and TaskHandler now validate the service method format and check method existence before dynamic invocation, preventing worker crashes with clear error messages.
Changes
Shared helper (src/Util/ServiceMethodHelper.php)
ProcessHandler & TaskHandler
Tests added (22 total)