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

Error output not sufficient #2779

Closed
6 tasks done
Beiri22 opened this issue Jan 31, 2023 · 0 comments · Fixed by #2829
Closed
6 tasks done

Error output not sufficient #2779

Beiri22 opened this issue Jan 31, 2023 · 0 comments · Fixed by #2829

Comments

@Beiri22
Copy link

Beiri22 commented Jan 31, 2023

Describe the bug

I am using sveltekit and came upon a problem when testing. I am testing a function that uses sveltekit's error() function to create an HTTPError. When this error occurs unexpectedly inside my tests, vitest only reports "Unknown Error: undefined", which does not help finding the issue. The HttpError itself contains useful information like status code and message:

HttpError {
  status: 401,
  body: {
    message: 'Some description'
  }
}

I'm not sure why, but maybe you check on that for a correct and useful error output.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-j4trhh?file=src/lookhere.test.ts

import { error } from '@sveltejs/kit';

test("Some Test",()=>{
    throw error(401, "Some message");
})

System Info

System:
    OS: Linux 6.2 Manjaro Linux
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
    Memory: 25.37 GB / 31.27 GB
    Container: Yes
    Shell: 3.6.0 - /usr/bin/fish
  Binaries:
    Node: 19.5.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 8.19.2 - /usr/bin/npm
  Browsers:
    Chromium: 109.0.5414.119
    Firefox: 109.0
  npmPackages:
    vite: ^4.0.0 => 4.0.4 
    vitest: ^0 => 0.28.3

Used Package Manager

npm

Validations

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants