Skip to content

refactor: minor code changes in karma AngularAssetsMiddleware #30115

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

Merged
merged 1 commit into from
Apr 22, 2025

Conversation

alan-agius4
Copy link
Collaborator

Early exits and reduce optional chaining.

@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: major This PR is targeted for the next major release labels Apr 16, 2025
@alan-agius4 alan-agius4 requested a review from jkrems April 16, 2025 09:39
Copy link
Contributor

@jkrems jkrems left a comment

Choose a reason for hiding this comment

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

This does now have the potential to call next multiple times in case of errors. But that might be okay..?

(The code invoked by next() may throw which then could get caught by this function and trigger a 2nd call to next().)

@alan-agius4
Copy link
Collaborator Author

This does now have the potential to call next multiple times in case of errors. But that might be okay..?

(The code invoked by next() may throw which then could get caught by this function and trigger a 2nd call to next().)

Yes, that should be fine though, what was the intent of the try/catch was it to catch error from this.serveFile or handle invalid new URL?

@jkrems
Copy link
Contributor

jkrems commented Apr 17, 2025

Yes, that should be fine though, what was the intent of the try/catch was it to catch error from this.serveFile or handle invalid new URL?

That's a good point! Since this entirely synchronous, we could likely depend on the framework to catch errors and remove the try/catch.

@1979Allen

This comment was marked as spam.

Early exits and reduce optional chaining.
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Apr 22, 2025
@alan-agius4 alan-agius4 merged commit 0459d80 into angular:main Apr 22, 2025
31 checks passed
@alan-agius4 alan-agius4 deleted the handle-cleanup branch April 22, 2025 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants