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

Support reject(error) calls when analysing Errors #51

Open
kamilafsar opened this issue Sep 30, 2022 · 0 comments
Open

Support reject(error) calls when analysing Errors #51

kamilafsar opened this issue Sep 30, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@kamilafsar
Copy link
Contributor

We parse/analyse all throw'n errors of the user. All errors are put in the SDK. One exception now is errors thrown with the Promise/reject syntax.

See recursivelyFindThrowStatements.test.ts

Here's how we could test for it:

test.skip("new Promise with reject", () => {
      const {
        statements: [funcOne],
        typeChecker,
      } = compileStatements(
        `
          async function funcOne(a: string): boolean {
            const x = await Promise.all([funcTwo()])
            return x[0];
          }
          async function funcTwo(): Promise<boolean> {
            return new Promise((resolve, reject) => {
              reject(new Error('error'))
            })
          }
        `,
      )

      expect(
        recursivelyFindThrowStatements(
          funcOne as ts.FunctionDeclaration,
          typeChecker,
        ),
      ).toHaveLength(1)
    })
@Jpunt Jpunt added the enhancement New feature or request label Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants