Enable debug option for pyschacl validation#281
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #281 +/- ##
==========================================
- Coverage 72.62% 72.40% -0.23%
==========================================
Files 90 90
Lines 5761 5787 +26
==========================================
+ Hits 4184 4190 +6
- Misses 1577 1597 +20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
kgforge/core/archetypes/store.py
Outdated
| data, | ||
| required_synchronized=False, | ||
| execute_actions=True, | ||
| catch_exceptions=catch_exceptions, |
There was a problem hiding this comment.
I would do:
catch_exceptions= not debug
|
I haven't implemented yet the option to delete distributions and deprecate files when registration fails. I would rather put that in a separate PR. |
| messages.append(str(the_details)) | ||
| else: | ||
| messages.append(str(result)) | ||
| return ". ".join(messages) |
There was a problem hiding this comment.
Is it an absolute must to join these? Or, better yet, does the result dictionaries have to be converted to str?
There was a problem hiding this comment.
This is a choice, would you like to have the full schacl error result? Maybe we can give it back when the debug option is true. However, if the intention is to make a nicer Error log, we can add it here, I don't know, what do you think?
There was a problem hiding this comment.
No, no. Not the full shacl output, absolutely not. It's just for flexibility of further handling the output.
For example, if the dict you gather above is kept as a dict, it would allow to catch and handle the output on user side like:
try: # this would happen in nexus-forge
reason = "Flux Capacitor is broken"
troubleshooting = {"attention": "Disconnect capacitor drive before opening", "safety": "Shield eyes from light", "actions": "do magic"}
raise ValueError(reason, troubleshooting)
except ValueError as e: # <-- error-handling on user side
print(f"ERROR: {e.args[0]}")
print("\nTroubleshooting Tips:")
for k,v in e.args[1].items():
print(f"\t{k.ljust(10)}: {v}")OUTPUT:
ERROR: Flux Capacitor is broken
Troubleshooting Tips:
attention : Disconnect capacitor drive before opening
safety : Shield eyes from light
actions : do magic
or we can just leave it as it is:
raise ValueError(reason, troubleshooting)OUTPUT:
# <traceback>
ValueError: ('Flux Capacitor is broken', {'attention': 'Disconnect capacitor drive before opening', 'safety': 'Shield eyes from light', 'actions': 'do magic'})
There was a problem hiding this comment.
On nexus-forge side, you would still able to format the messages any way you want in execution.py. What do you think?
There was a problem hiding this comment.
Ah ok ok, I understand now your point, yes, I like it, I will make some changes, still not decided on if returning the dictionary, but already improved the message.
|
I was testing the newest changes, and we're discussing about it in NSETM-2067. Instead of opening a new ticket, I'll relay a comment from @jdcourcol, before this is pushed to master:
|
… to provide correct response message.
4aa8b8a to
b627883
Compare
ssssarah
left a comment
There was a problem hiding this comment.
I have yet to run things to see what happens
In the effort to solve #280 this option let's us use the
debugversion of the pyschacl validator.