File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
airbyte_cdk/sources/file_based/file_types Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,15 @@ def parse_records(
162
162
logger .warn (f"File { file .uri } cannot be parsed. Skipping it." )
163
163
else :
164
164
raise e
165
+ except Exception as e :
166
+ exception_str = str (e )
167
+ logger .warn (f"File { file .uri } caused an error during parsing: { exception_str } ." )
168
+ yield {
169
+ "content" : None ,
170
+ "document_key" : file .uri ,
171
+ "_ab_source_file_parse_error" : exception_str ,
172
+ }
173
+ logger .warn (f"File { file .uri } cannot be parsed. Skipping it." )
165
174
166
175
def _read_file (
167
176
self ,
@@ -186,7 +195,7 @@ def _read_file(
186
195
remote_file ,
187
196
self ._get_file_type_error_message (filetype ),
188
197
)
189
- if filetype in {FileType .MD , filetype is FileType .TXT }:
198
+ if filetype in {FileType .MD , FileType .TXT }:
190
199
file_content : bytes = file_handle .read ()
191
200
decoded_content : str = optional_decode (file_content )
192
201
return decoded_content
You can’t perform that action at this time.
0 commit comments