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

fix: wrong stacktrace type #189

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion __tests__/commonTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,15 @@ export function createCommonTests({
await waitForExpect(() => expect(testkit.reports()).toHaveLength(1))
})

test('should have an error object with the captured exception', async function() {
test('should have an error object with the captured exception and stacktrace', async function() {
Sentry.captureException(new Error('sentry test kit is awesome!'))
await waitForExpect(() => expect(testkit.reports()).toHaveLength(1))
expect(testkit.reports()[0]!.error).toMatchObject({
name: 'Error',
message: 'sentry test kit is awesome!',
stacktrace: {
frames: expect.any(Array),
},
})
})

Expand Down
4 changes: 2 additions & 2 deletions browser.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
Breadcrumb,
User,
SeverityLevel,
StackFrame,
Stacktrace,
Transport,
} from '@sentry/types'

Expand All @@ -22,7 +22,7 @@ declare namespace sentryTestkit {
interface ReportError {
name: string
message: string
stacktrace: StackFrame[]
stacktrace: Stacktrace
}

interface Report {
Expand Down
4 changes: 2 additions & 2 deletions docs/api/reportError.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ The error name
#### `message` [string]
The error message

#### `stacktrace` [[StackFrame[]](https://github.com/getsentry/sentry-javascript/blob/master/packages/types/src/stackframe.ts)]
The error stacktrace as individual frames
#### `stacktrace` [[Stacktrace[]](https://github.com/getsentry/sentry-javascript/blob/master/packages/types/src/stacktrace.ts)]
The error stacktrace as individual frames
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
Breadcrumb,
User,
SeverityLevel,
StackFrame,
Stacktrace,
Transport,
} from '@sentry/types'

Expand All @@ -22,7 +22,7 @@ declare namespace sentryTestkit {
interface ReportError {
name: string
message: string
stacktrace: StackFrame[]
stacktrace: Stacktrace
}

interface Report {
Expand Down
4 changes: 2 additions & 2 deletions website/docs/api/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Represents a report error object. The object has the following keys:
//The error message
message: string
// The error stacktrace as individual frames
stacktrace: StackFrame[]
stacktrace: Stacktrace
}
```
**See:** [StackFrame](https://github.com/getsentry/sentry-javascript/blob/master/packages/types/src/stackframe.ts)
**See:** [Stacktrace](https://github.com/getsentry/sentry-javascript/blob/master/packages/types/src/stacktrace.ts)

### `Report`

Expand Down
Loading