Skip to content

replace bare except: with specific exception types#167

Open
Devguru-codes wants to merge 1 commit into
OSIPI:mainfrom
Devguru-codes:fix-bare-except
Open

replace bare except: with specific exception types#167
Devguru-codes wants to merge 1 commit into
OSIPI:mainfrom
Devguru-codes:fix-bare-except

Conversation

@Devguru-codes
Copy link
Copy Markdown
Contributor

Replace all 13 bare except: blocks in LSQ_fitting.py and 1 in triexp_fitting_algorithms.py with specific exception types:

  • Parallel fallbacks: except Exception
  • curve_fit/minimize failures: except (RuntimeError, ValueError)
  • Bayesian fit: except (RuntimeError, ValueError, TypeError)
  • Goodness-of-fit: except (IndexError, ValueError)
  • NNLS: except Exception

Also fix pre-existing bug: raise(params.message) on line 668 was raising a string (TypeError), not an exception. Changed to raise RuntimeError(params.message).

Fixes #166

Replace all 13 bare except: blocks in LSQ_fitting.py and 1 in
triexp_fitting_algorithms.py with specific exception types:

- Parallel fallbacks: except Exception
- curve_fit/minimize failures: except (RuntimeError, ValueError)
- Bayesian fit: except (RuntimeError, ValueError, TypeError)
- Goodness-of-fit: except (IndexError, ValueError)
- NNLS: except Exception

Also fix pre-existing bug: raise(params.message) on line 668 was
raising a string (TypeError), not an exception. Changed to
raise RuntimeError(params.message).

Fixes Bug OSIPI#3 from bugs.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Bare except: blocks in original algorithm implementations

1 participant