Skip to content

Commit

Permalink
fix: wrong stacktrace type
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl authored and zivl committed Nov 21, 2023
1 parent 4ece855 commit 3f27cb6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
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

0 comments on commit 3f27cb6

Please sign in to comment.