Skip to content

Commit cba3c65

Browse files
rename caller to callingFn
1 parent 467d6f5 commit cba3c65

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/shared/api/rejectNetworkError.test.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,22 @@ const parsingError: ParsingErrorObject = {
4141
errorName: 'Parsing Error',
4242
errorDetails: {
4343
error: Error('bad parsing'),
44-
caller: 'TestQueryOpts',
44+
callingFn: 'TestQueryOpts',
4545
},
4646
}
4747

4848
const notFoundError: NotFoundErrorObject = {
4949
errorName: 'Not Found Error',
5050
errorDetails: {
51-
caller: 'TestQueryOpts',
51+
callingFn: 'TestQueryOpts',
5252
},
5353
}
5454

5555
const ownerNotActivatedError: OwnerNotActivatedErrorObject = {
5656
errorName: 'Owner Not Activated',
5757
data: { detail: 'test' },
5858
errorDetails: {
59-
caller: 'TestQueryOpts',
59+
callingFn: 'TestQueryOpts',
6060
},
6161
}
6262

@@ -76,7 +76,7 @@ describe('rejectNetworkError', () => {
7676
expect(mocks.addBreadcrumb).toHaveBeenCalledWith({
7777
category: 'network.error',
7878
level,
79-
message: `${errorObject.errorDetails.caller} - ${errorObject.errorName}`,
79+
message: `${errorObject.errorDetails.callingFn} - ${errorObject.errorName}`,
8080
data:
8181
'error' in errorObject.errorDetails
8282
? errorObject.errorDetails.error
@@ -88,7 +88,7 @@ describe('rejectNetworkError', () => {
8888
_rejectNetworkError(errorObject).catch((_e) => {})
8989

9090
expect(mocks.setTags).toHaveBeenCalledWith({
91-
caller: errorObject.errorDetails.caller,
91+
callingFn: errorObject.errorDetails.callingFn,
9292
errorName: errorObject.errorName,
9393
})
9494
})
@@ -102,7 +102,7 @@ describe('rejectNetworkError', () => {
102102
it('sets the fingerprint', () => {
103103
_rejectNetworkError(errorObject).catch((_e) => {
104104
expect(mocks.setFingerprint).toHaveBeenCalledWith([
105-
`${errorObject.errorDetails.caller} - ${errorObject.errorName}`,
105+
`${errorObject.errorDetails.callingFn} - ${errorObject.errorName}`,
106106
])
107107
})
108108
})
@@ -111,15 +111,15 @@ describe('rejectNetworkError', () => {
111111
_rejectNetworkError(errorObject).catch((_e) => {})
112112

113113
expect(mocks.captureMessage).toHaveBeenCalledWith(
114-
`${errorObject.errorDetails.caller} - ${errorObject.errorName}`
114+
`${errorObject.errorDetails.callingFn} - ${errorObject.errorName}`
115115
)
116116
})
117117

118118
it('returns a rejected promise', () => {
119119
const result = _rejectNetworkError(errorObject)
120120

121121
expect(result).rejects.toStrictEqual({
122-
dev: `${errorObject.errorDetails.caller} - ${errorObject.errorName}`,
122+
dev: `${errorObject.errorDetails.callingFn} - ${errorObject.errorName}`,
123123
data: 'data' in errorObject ? errorObject.data : undefined,
124124
status,
125125
})

src/shared/api/rejectNetworkError.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ export type NetworkErrorName =
1111

1212
export type ParsingErrorObject = {
1313
errorName: ParsingError
14-
errorDetails: { error: Error; caller: string }
14+
errorDetails: { error: Error; callingFn: string }
1515
}
1616

1717
export type NotFoundErrorObject = {
1818
errorName: NotFoundError
19-
errorDetails: { caller: string }
19+
errorDetails: { callingFn: string }
2020
}
2121

2222
export type OwnerNotActivatedErrorObject = {
2323
errorName: OwnerNotActivatedError
2424
data: { detail?: React.ReactNode }
25-
errorDetails: { caller: string }
25+
errorDetails: { callingFn: string }
2626
}
2727

2828
type NetworkErrorObject =
@@ -65,10 +65,10 @@ export function determineStatusCode(errorName: NetworkErrorName) {
6565
export function _rejectNetworkError(error: NetworkErrorObject) {
6666
const {
6767
errorName,
68-
errorDetails: { caller },
68+
errorDetails: { callingFn },
6969
} = error
7070

71-
const devMsg = `${caller} - ${errorName}`
71+
const devMsg = `${callingFn} - ${errorName}`
7272

7373
Sentry.withScope((scope) => {
7474
const level = determineSentryLevel(errorName)
@@ -81,7 +81,7 @@ export function _rejectNetworkError(error: NetworkErrorObject) {
8181
})
8282

8383
scope.setTags({
84-
caller: caller,
84+
callingFn: callingFn,
8585
errorName: errorName,
8686
})
8787

0 commit comments

Comments
 (0)