brijrajk commented on code in PR #56174: URL: https://github.com/apache/spark/pull/56174#discussion_r3905895172
########## python/pyspark/sql/protobuf/functions.py: ########## @@ -286,9 +287,14 @@ def to_protobuf( def _read_descriptor_set_file(filePath: str) -> bytes: - # TODO(SPARK-43847): Throw structured errors like "PROTOBUF_DESCRIPTOR_FILE_NOT_FOUND" etc. - with open(filePath, "rb") as f: - return f.read() + try: + with open(filePath, "rb") as f: + return f.read() + except OSError as e: Review Comment: Good catch, fixed. Narrowed to `FileNotFoundError` so `PermissionError`, `IsADirectoryError`, and the rest keep propagating unchanged. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
