Closed tovrstra closed 5 months ago
This pull request addresses a task from issue #191 by splitting the FileFormatError
and FileFormatWarning
into more specific LoadError
, LoadWarning
, DumpError
, and DumpWarning
classes. The changes aim to make error messages more informative and specific to the context of loading or dumping data. The FileFormatError
is retained but is now only used for errors related to identifying or selecting the correct file format. The changes also include updating the exception handling in various modules and tests to use the new error classes.
Files | Changes |
---|---|
iodata/formats/json.py iodata/api.py iodata/utils.py iodata/test/test_json.py iodata/formats/mwfn.py iodata/test/test_cp2klog.py iodata/formats/pdb.py iodata/test/test_pdb.py iodata/formats/gromacs.py iodata/formats/fchk.py iodata/formats/mol2.py iodata/formats/molden.py iodata/formats/molekel.py iodata/test/common.py iodata/test/test_wfx.py iodata/test/test_api.py iodata/test/test_inputs.py iodata/test/test_sdf.py iodata/formats/gamess.py iodata/formats/gaussianinput.py iodata/test/test_mol2.py |
Replaced FileFormatError and FileFormatWarning with more specific LoadError , LoadWarning , DumpError , and DumpWarning classes. Updated exception handling in various modules and tests to use the new error classes. |
Here's the code health analysis summary for commits 3f2e4fc..cfbbceb
. View details on DeepSource ↗.
Analyzer | Status | Summary | Link |
---|---|---|---|
Shell | ✅ Success | View Check ↗ | |
Python | ✅ Success | 🎯 2 occurences resolved | View Check ↗ |
💡 If you’re a repository administrator, you can configure the quality gates from the settings.
Thanks for checking, Paul.
I've also double-checked it, but could not spot obvious mistakes. The critical parts will be revisited in future pull requests, so I'll be taking a second look in any case.
This fixes a task in #191: splitting
FileFormatError
andFileFormatWarning
intoLoad...
andDump...
versions, and fix formats that raise various generic exceptions. There is still aFileFormatError
, but it is only used for errors related to identifying or selecting the correct file format. This fix will make error messages more informative in general, and it will make the original goal of #191 easier to achieve.Note that there are a few more tasks related to exception handling in #191, not included in this PR, to keep it small. Cleanups like these quickly become large, so I've suppressed the usual oh-I-can-also-fix-this reflex and deferred these to future PRs instead.
I will YOLO-merge this on June 28 unless reviewed earlier.
Summary by Sourcery
Refactored exception handling to provide more specific error types for loading and dumping operations, and updated corresponding test cases.
FileFormatError
andFileFormatWarning
intoLoadError
,LoadWarning
,DumpError
, andDumpWarning
for more specific error categorization.LoadWarning
andLoadError
instead ofFileFormatWarning
andFileFormatError
.