Skip to content

Conversation

yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR commented Oct 5, 2022

  1. prune try block within completeAsyncIteratorValue to better reflect what might throw
  2. type result of iterator .next() calls
  3. replaced handleError helper with addError with the new function also calling locatedError
  4. introduce handleRawError helper which also includes filtering of async payloads
  5. pass subsequentPayloads rather than entire exeContext

extracted from #3754

@netlify
Copy link

netlify bot commented Oct 5, 2022

Deploy Preview for compassionate-pike-271cb3 ready!

Name Link
🔨 Latest commit 86a84ac
🔍 Latest deploy log https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/63b43b5216080a0009c3c7f2
😎 Deploy Preview https://deploy-preview-3756--compassionate-pike-271cb3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@yaacovCR yaacovCR requested review from a team and robrichard October 5, 2022 19:14
@yaacovCR yaacovCR added the PR: polish 💅 PR doesn't change public API or any observed behaviour label Oct 5, 2022
addError calls locatedError and then adds the error as previously in
handleFieldError, throwing if the type is non-null.

As opposed to handleFieldError, it does not return null, so as to require
the calling function to be more explicit about the new value.
@yaacovCR yaacovCR force-pushed the simple-refactors branch 3 times, most recently from 5d17294 to 41f5420 Compare January 3, 2023 13:34
@yaacovCR yaacovCR requested a review from a team January 3, 2023 13:35
const error = locatedError(rawError, fieldNodes, pathToArray(path));
const handledError = handleFieldError(error, returnType, errors);
const errors = asyncPayloadRecord?.errors ?? exeContext.errors;
addError(rawError, fieldNodes, returnType, path, errors);
Copy link
Member

Choose a reason for hiding this comment

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

Not sure about this one, especially since addError throws located error.
But since it's not a public API, let's try and merge it.

Future suggestion: If we convert ExecutionContext into class it can have single method called handleFieldError that:

  1. locateError
  2. push error into errors
  3. filterSubsequentPayloads

Copy link
Member

@IvanGoncharov IvanGoncharov left a comment

Choose a reason for hiding this comment

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

Makes sense 👍
@yaacovCR Thank you for extracting it 🙇

@yaacovCR
Copy link
Contributor Author

yaacovCR commented Jan 6, 2023

Probably makes sense to wait on this until #3815 is approved, which could require a spec change. Filtering is complex!

@yaacovCR
Copy link
Contributor Author

refactors 3 and 4 from this were merged in #3878

some of the remaining minor changes from this refactoring PR perhaps could be revisited, but I am closing this stale PR for now.

@yaacovCR yaacovCR closed this Mar 20, 2024
@yaacovCR yaacovCR deleted the simple-refactors branch March 20, 2024 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: polish 💅 PR doesn't change public API or any observed behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants