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

refactor: two toggles for strict error handling and server error propagation #18815

Conversation

pawelfras
Copy link
Contributor

No description provided.

@pawelfras pawelfras requested a review from a team as a code owner May 8, 2024 13:32
Comment on lines 32 to 33
protected isServerErrorPropagationEnabled =
inject(FeatureToggles).serverErrorPropagation;
Copy link
Contributor

@Platonn Platonn May 8, 2024

Choose a reason for hiding this comment

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

Let's:

  • inject FeatureConfigService as private property
  • call it inline .isEnabled() in line 36

(it's not to leave unnecessary properties in public API protected that will need to be removed)

Note: it applies to also other places in this PR

cachingStrategyResolver: (entry) => !entry.error,
ssrErrorHandling: true,
cacheStrategyResolver: (options, entry) =>
!!options.cacheErrors && !!entry.error,
Copy link
Contributor

@Platonn Platonn May 8, 2024

Choose a reason for hiding this comment

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

  1. we have to check if cacheErrors is expliclity === true. Becuase otherwise also undefined makes it falsy by default - and we dont want to toggle it falsy by default.
  2. IMHO semantics of a flag should be falsy when disabled (by default) and truthy when enabled.

What about switching the meaning to avoidCachingErrors. IMHO it's more attactive and understandable for customers to toggle it on. Moreover when it's falsy (false/undefined) => the new behavior is disabled

Comment on lines 146 to 148
/**
* Enable caching of errors. By default, errors are not cached.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

let update jsdocs

@pawelfras pawelfras merged commit f8143ee into feat/CXSPA-6939-poc-handling-breaking-changes May 9, 2024
4 checks passed
@pawelfras pawelfras deleted the feat/CXSPA-6939-toggle-for-sealed-error-handling-and-for-error-propagation branch May 9, 2024 11:10
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.

None yet

2 participants