-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provenance hints to user_note and user_error and error handling for missing coupling direction #1277
Conversation
(cherry picked from commit 2ec4500)
This can still be improved, for example, by making an |
Yes, plus 100000000 points. Having those be in from loguru import logger
# Alternatively: from esm_tools.logging import logger (see implementation in pymorize)
class Hint
def __init__(self, message):
self.message = message
def error(self, message=None):
if message is None:
message = self.message
logger.error(message)
# Same with info, debug, critical, etc ...something like that. Maybe with static methods so you don't need to initialise the object. |
…r_handling.py module). Black error_handling.py. isort all .py files containing changes
done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have one naming suggestion, otherwise this is good to go.
#bump |
#bump |
get_first_provenance
method to more easily use the first occurrence of provenance in a dictionary or list to report suggestions in the error messagesuser_error
anduser_note
: if you add a list of hints as input to one of this methods, you can add<HINT_#>
placeholders to your message foruser_note
anduser_error
. These place holders will be substituted using the hint's properties you define for each hint.For #1268 it generates this user error now:
![Screenshot 2025-01-21 at 19 23 12](https://private-user-images.githubusercontent.com/63242832/405342299-74403d70-71c5-43d4-be2e-f3aff357fb89.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4ODQ2NDIsIm5iZiI6MTczODg4NDM0MiwicGF0aCI6Ii82MzI0MjgzMi80MDUzNDIyOTktNzQ0MDNkNzAtNzFjNS00M2Q0LWJlMmUtZjNhZmYzNTdmYjg5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDIzMjU0MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZhNjJhZTIwODdlYzQwYjNhNmI1OGJlM2VkNGNiNzE3OWU4NDlhOWMyZjA0ZGFkZGU0ZWZhOGJhMGFjZjc4MmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.y3l3jTJvrXJ4f58rq93f9_PnyeyIaTM1hQndm9wwba0)
Closes #1268