Skip to content

Commit

Permalink
fix: wrong stacktrace type
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl committed Nov 18, 2023
1 parent 4ece855 commit 905cb46
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
8 changes: 6 additions & 2 deletions __tests__/commonTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,17 @@ 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({
const error = testkit.reports()[0]!.error
expect(error).toMatchObject({
name: 'Error',
message: 'sentry test kit is awesome!',
})
expect(error?.stacktrace).toMatchObject({
frames: expect.any(Array),
})
})

test('should have release data on the report as given in Sentry.init', async function() {
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 905cb46

Please sign in to comment.