Commit 1a28c6c
committed
Fix #1160: Replace broad except Exception with specific exception types in phenotypes.py
The code had 5 instances of except Exception that silently converted
real bugs into warnings, returning empty/partial data. This is dangerous
for scientific analysis where data correctness is critical.
Changes:
- Site 1 (_load_phenotype_data): Narrowed to (KeyError, FileNotFoundError, IOError)
- Site 2 (_create_phenotype_dataset): Removed redundant catch-all (KeyError
and ValueError were already caught above)
- Site 3 (phenotype_data): Removed try/except around sample_metadata() —
let errors from the upstream API propagate naturally
- Site 4 (phenotype_data query): Narrowed to
(pd.errors.UndefinedVariableError, SyntaxError) for malformed queries
- Site 5 (phenotype_sample_sets): Narrowed to (KeyError, FileNotFoundError)1 parent 05337a5 commit 1a28c6c
1 file changed
Lines changed: 6 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 73 | + | |
| 74 | + | |
77 | 75 | | |
78 | 76 | | |
79 | 77 | | |
| |||
307 | 305 | | |
308 | 306 | | |
309 | 307 | | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | 308 | | |
316 | 309 | | |
317 | 310 | | |
| |||
346 | 339 | | |
347 | 340 | | |
348 | 341 | | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
| 342 | + | |
354 | 343 | | |
355 | 344 | | |
356 | 345 | | |
| |||
373 | 362 | | |
374 | 363 | | |
375 | 364 | | |
376 | | - | |
377 | | - | |
| 365 | + | |
| 366 | + | |
378 | 367 | | |
379 | 368 | | |
380 | 369 | | |
| |||
494 | 483 | | |
495 | 484 | | |
496 | 485 | | |
497 | | - | |
| 486 | + | |
498 | 487 | | |
499 | 488 | | |
500 | 489 | | |
| |||
0 commit comments