apache / apache/beam

Faling to re-raise exceptions

Open
#18,294 0 comments 0 reactions 0 assignees View on GitHub
bug core P3 python
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

In runners common.py `reraise_augmented` fails to re-raise exceptions in some case.

`raise type(exn), args, sys.exc_info()[2]`

The above code assumes that the Exception can be reconstructed from its arguments but this is not always true for custom exception classes. (e.g. `RPCError` in https://github.com/GoogleCloudPlatform/google-cloud-datastore/blob/master/python/googledatastore/connection.py#L226

This re-raising could first attempt to re-create the exception and if that does not fail raise otherwise raise the original exception as is.

(cc: [~robertwb])

Imported from Jira [BEAM-1901](https://issues.apache.org/jira/browse/BEAM-1901). Original Jira may contain additional context.
Reported by: altay.

Contributor guide

Open the contributing guide

Research direction

Start in runners common.py at reraise_augmented and inspect how the current raise statement reconstructs exceptions from their arguments. Reproduce the failure with a custom exception such as the referenced RPCError, then verify that reconstruction still works when possible and that the original exception is preserved when it does not.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.