kit icon indicating copy to clipboard operation
kit copied to clipboard

rename `App.PageError` to `App.Error`

Open Rich-Harris opened this issue 2 years ago • 4 comments

closes #6905. This is a breaking change, but I expect it to be very limited in impact.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • [x] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • [x] This message body should clearly illustrate what problems it solves.
  • [ ] Ideally, include a test that fails without this PR but passes with it.

Tests

  • [x] Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • [x] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

Rich-Harris avatar Sep 22 '22 13:09 Rich-Harris

🦋 Changeset detected

Latest commit: 2f0f71e800c352415583f1e74782b56798b8bb1b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@sveltejs/kit Patch
create-svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Sep 22 '22 13:09 changeset-bot[bot]

Do you want to implement the "try to rename that inside src/app.d.ts during sync" thing I proposed in the issue, or did you decide against it?

dummdidumm avatar Sep 22 '22 14:09 dummdidumm

I agree with Dominik that it's probably a slippery slope. I think throwing an error telling the user to change it could be good, it just felt like a lot of effort when considering that we don't enforce a specific location for the user to declare those namespaces

Rich-Harris avatar Sep 22 '22 14:09 Rich-Harris

We don't but I guess that 90% of the 5% of people that use this have it inside src/app.d.ts, which is where the starter templates put this, so we could check if that file exists, if yes if it has the app namespace, if yes if it has AppError in there, if yes throw, else do nothing.

dummdidumm avatar Sep 22 '22 15:09 dummdidumm

Not sure if it matters much, but even if PageError is commented in app.d.ts/js, the error will be produced: error when starting dev server: Error: App.PageError has been renamed to App.Error — please update your src/app.d.ts

// app.d.ts
// interface PageError {}

asmajlovicmars avatar Sep 23 '22 13:09 asmajlovicmars

Mhm yeah that's probably very annoying for everyone who doesn't even use it - probably worth expanding the check to see if it's commented out.

dummdidumm avatar Sep 23 '22 14:09 dummdidumm