Create a ChordError preserving the original exception as __cause__. This helper reduces code duplication across the codebase when creating ChordError instances that need to preserve the original exception.
(message, original_exc=None)
| 66 | |
| 67 | |
| 68 | def _create_chord_error_with_cause(message, original_exc=None) -> ChordError: |
| 69 | """Create a ChordError preserving the original exception as __cause__. |
| 70 | |
| 71 | This helper reduces code duplication across the codebase when creating |
| 72 | ChordError instances that need to preserve the original exception. |
| 73 | """ |
| 74 | chord_error = ChordError(message) |
| 75 | if isinstance(original_exc, Exception): |
| 76 | chord_error.__cause__ = original_exc |
| 77 | return chord_error |
| 78 | |
| 79 | |
| 80 | def _create_fake_task_request(task_id, errbacks=None, task_name='unknown', **extra) -> Context: |