Skip to content
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

Allow users to handle invalid nodes coming from a search against the API #431

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

InnocentBug
Copy link
Collaborator

Description

Before there was no path to recovery if an API search was returning nodes that were deemed incorrect by the SDK.
Now, there is a way to disable auto node conversion.

I think this should only be last resort to recover for advanced users.
But I included an FAQ to explain it to users.

Changes

Known Issues

Notes

Checklist

  • My name is on the list of contributors (CONTRIBUTORS.md) in the pull request source branch.
  • I have updated the documentation to reflect my changes.
  • My code changes have been verified by automated tests and pass all relevant test scenarios.

@InnocentBug InnocentBug self-assigned this Feb 27, 2024
Copy link

trunk-io bot commented Feb 27, 2024

Merging to develop in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

except IndexError: # This is not a random access iteration.
# So if fetching a next page wasn't enough to get the index inbound,
# The iteration stops
raise StopIteration

if self.auto_load_nodes:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the ❤️ of this PR.

while True:
try:
try:
material_node = next(materials_paginator)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is using the change in a test.

@@ -97,6 +97,55 @@ the code is written to get a better grasp of it?
There you will find documentation on everything from how our code is structure,
how we aim to write our documentation, CI/CD, and more._

---

**Q:** What can I do, when my `api.search(...)` fails with a `cript.nodes.exception.CRIPTJsonDeserializationError` or similar?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FAQ to explain to users of how to recover from bad search results.
(Hopefully rarely needed.)
But good to have for debugging anyways.

@InnocentBug InnocentBug mentioned this pull request Feb 28, 2024
3 tasks
@InnocentBug InnocentBug merged commit 39a0862 into develop Feb 28, 2024
13 checks passed
@InnocentBug InnocentBug deleted the robust-paginator branch March 27, 2024 13:22
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.

2 participants