Skip to content

Commit ff51c1d

Browse files
fix: avoid TypeError if resp is undefined (#1273)
When `resp` is undefined, this error handling code will itself throw "TypeError: Cannot read properties of undefined (reading 'insertErrors')" Instead of throwing, we can use optional chaining to allow the error message to be handled as expected. Co-authored-by: Lo Ferris <[email protected]>
1 parent 41e52c5 commit ff51c1d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/rowQueue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export class RowQueue {
168168
json,
169169
},
170170
(err, resp) => {
171-
const partialFailures = (resp.insertErrors || []).map(
171+
const partialFailures = (resp?.insertErrors || []).map(
172172
(insertError: GoogleErrorBody) => {
173173
return {
174174
errors: insertError.errors!.map(error => {

0 commit comments

Comments
 (0)