Skip to content

Core: Improve internal types#23632

Merged
JReinhold merged 2 commits into
indexer-apifrom
improve-core-server-types
Jul 29, 2023
Merged

Core: Improve internal types#23632
JReinhold merged 2 commits into
indexer-apifrom
improve-core-server-types

Conversation

@JReinhold
Copy link
Copy Markdown
Contributor

@JReinhold JReinhold commented Jul 27, 2023

What I did

While merging next and #23182 into this branch, @kasperpeulen and I noticed some typing stuff we wanted to improve, so we did that here.

@shilman you want to notice the changes to the telemetry logic:

  • the original PR changed it so only errors were printed and sent, this reverts that so everything is sent
  • made sendTelemetryError support unknown parameter, so you don't have to check the caught error being an instanceof error every time, you can just pass it in.

How to test

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "build", "documentation", "maintenance", "dependencies", "other"]

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

@JReinhold JReinhold requested a review from kasperpeulen July 27, 2023 13:05
@JReinhold JReinhold self-assigned this Jul 27, 2023
@JReinhold JReinhold marked this pull request as ready for review July 27, 2023 13:06
Copy link
Copy Markdown
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

@JReinhold I don't think this is going to work unless you also fixed the code path that throws a non-error. I never really understood this error code. Perhaps @tmeasday or @ndelangen has more context

@JReinhold JReinhold added maintenance User-facing maintenance tasks ci:normal labels Jul 27, 2023
@JReinhold
Copy link
Copy Markdown
Contributor Author

It's a bit of a convenience @kasperpeulen and I came up with. The current code and the changes here assumes that everyone is always throwing an error, and never something else. We feel that's a fair assumption, being able to throw anything but an error feels like a bug in the language.

This convenient change just means that you don't have to convert your unknown error to an Error every time you call this code.

Copy link
Copy Markdown
Member

@kasperpeulen kasperpeulen left a comment

Choose a reason for hiding this comment

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

LGTM!

@JReinhold JReinhold merged commit dbd8759 into indexer-api Jul 29, 2023
@JReinhold JReinhold deleted the improve-core-server-types branch July 29, 2023 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:normal maintenance User-facing maintenance tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants