Skip to content

Comments

Update error message#292

Merged
sbillinge merged 5 commits intodiffpy:mainfrom
Sparks29032:error_message
Feb 24, 2026
Merged

Update error message#292
sbillinge merged 5 commits intodiffpy:mainfrom
Sparks29032:error_message

Conversation

@Sparks29032
Copy link
Collaborator

@Sparks29032 Sparks29032 commented Feb 24, 2026

Closes #291
image

@Sparks29032
Copy link
Collaborator Author

Our current implementation groups all diffpy.morph errors into a SystemExit for CLI to exit. A user can thus except all diffpy.morph errors through a SystemExit.

@sbillinge
Copy link
Contributor

please see my other comment. I dislike this solution on the basis that it is ugly. I would rather crash with an Error but a really good error message so the users don't freak out.

@Sparks29032
Copy link
Collaborator Author

No more system exit:
image

@Sparks29032
Copy link
Collaborator Author

Sparks29032 commented Feb 24, 2026

The traceback cannot be removed without system exit or if I wrap the entire program in a try except.

@sbillinge
Copy link
Contributor

sbillinge commented Feb 24, 2026

Nice. Please see comment. Traceback is fine. It contains more information.

@Sparks29032
Copy link
Collaborator Author

Sparks29032 commented Feb 24, 2026

Nice. Please see comment. Traceback is fine. It contains more information.

Which comment? I did not see a new one. The error messages are all tailored to the specific failure-mode already. We have now edited so the actual error mode can be excepted (e.g. except ValueError)

def custom_error(self, msg):
"""custom_error(msg : string)
def morph_error(self, msg, error):
"""morph_error(msg : string)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make the docstring a bit better (and also accurate)

parser.custom_error(
"Too many arguments. You must only supply a FILE and a DIRECTORY."
parser.morph_error(
"Too many arguments. You must only supply a FILE and a DIRECTORY.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File or a directory?

@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.93%. Comparing base (fc45fa1) to head (8a8f008).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #292      +/-   ##
==========================================
- Coverage   99.93%   99.93%   -0.01%     
==========================================
  Files          24       24              
  Lines        1480     1479       -1     
==========================================
- Hits         1479     1478       -1     
  Misses          1        1              
Files with missing lines Coverage Δ
tests/test_morphapp.py 100.00% <100.00%> (ø)
tests/test_morphsqueeze.py 100.00% <100.00%> (ø)
tests/test_refine.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sbillinge sbillinge merged commit 73035a3 into diffpy:main Feb 24, 2026
7 checks passed
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.

Let users know to except SystemExit

2 participants