Skip to content

Conversation

@Rich-Harris
Copy link
Member

We use error names like UpdatedAtError when inspecting things, apparently because you need an Error suffix for the stack trace to be printed sensibly. But I'm trying this locally and... it seems like that's not the case? This works fine:

image

Firefox also has the same behaviour with or without the suffix. Safari does its own thing, naturally — formats the stack traces totally differently, and doesn't respect stackTraceLimit so the result would be pretty useless anyway. So I also added a check to prevent us from just logging null. (Have I ever mentioned that Safari is bad?)

Caveat: it's possible that something different happens on Windows? idk man.

Closes #17014.

Before submitting the PR, please make sure you do the following

  • 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
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

@changeset-bot
Copy link

changeset-bot bot commented Oct 24, 2025

🦋 Changeset detected

Latest commit: 145bbad

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

This PR includes changesets to release 1 package
Name Type
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

@github-actions
Copy link
Contributor

Playground

pnpm add https://pkg.pr.new/svelte@17026

@vladshcherbin
Copy link

Is it possible to also get some config flag to turn stack traces off with regular $inspect, just like it was before?

Writing $inspect(thing).with(console.log) just to see previous clean output is a bit much 🙏

@7nik
Copy link
Contributor

7nik commented Oct 24, 2025

image In firefox, REPL's console doesn't print the stack, but does in chrome. BTW, another thing that always annoys me about the console is that it never shows the `error.message`, just bare `DOMException` or so, and you always have to open the devtools. But this seems to be FF only thing too.

@dummdidumm
Copy link
Member

dummdidumm commented Oct 24, 2025

Tested in Chrome and Firefox on windows, works. This must be new.

@frederikhors
Copy link

Is it possible to also get some config flag to turn stack traces off with regular $inspect, just like it was before?

Writing $inspect(thing).with(console.log) just to see previous clean output is a bit much 🙏

Please, Svelte team, look at this.

@dummdidumm
Copy link
Member

dummdidumm commented Oct 24, 2025

Could we do something with console.group to appease the "I don't want stack traces by default" crowd?

@Rich-Harris Rich-Harris merged commit d8137b7 into main Oct 25, 2025
18 checks passed
@Rich-Harris Rich-Harris deleted the nicer-stack-traces branch October 25, 2025 15:29
@github-actions github-actions bot mentioned this pull request Oct 25, 2025
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.

[5.41.2] $inspect updates give negative feeling due to UpdatedAtError

6 participants