Merge pull request #15491 from Budibase/sheets-errors

Flesh out Google Sheets errors in testing to try and find a flake.
This commit is contained in:
Sam Rose 2025-02-05 17:48:53 +00:00 committed by GitHub
commit 637a63706d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 2 deletions

View File

@ -609,7 +609,15 @@ export class GoogleSheetsMock {
for (let col = startColumnIndex; col <= endColumnIndex; col++) { for (let col = startColumnIndex; col <= endColumnIndex; col++) {
const cell = this.getCellNumericIndexes(sheetId, row, col) const cell = this.getCellNumericIndexes(sheetId, row, col)
if (!cell) { if (!cell) {
throw new Error("Cell not found") const sheet = this.getSheetById(sheetId)
if (!sheet) {
throw new Error(`Sheet ${sheetId} not found`)
}
const sheetRows = sheet.data[0].rowData.length
const sheetCols = sheet.data[0].rowData[0].values.length
throw new Error(
`Failed to find cell at ${row}, ${col}. Range: ${valueRange.range}. Sheet dimensions: ${sheetRows}x${sheetCols}.`
)
} }
const value = const value =
valueRange.values[row - startRowIndex][col - startColumnIndex] valueRange.values[row - startRowIndex][col - startColumnIndex]
@ -638,7 +646,15 @@ export class GoogleSheetsMock {
for (let col = startColumnIndex; col <= endColumnIndex; col++) { for (let col = startColumnIndex; col <= endColumnIndex; col++) {
const cell = this.getCellNumericIndexes(sheetId, row, col) const cell = this.getCellNumericIndexes(sheetId, row, col)
if (!cell) { if (!cell) {
throw new Error("Cell not found") const sheet = this.getSheetById(sheetId)
if (!sheet) {
throw new Error(`Sheet ${sheetId} not found`)
}
const sheetRows = sheet.data[0].rowData.length
const sheetCols = sheet.data[0].rowData[0].values.length
throw new Error(
`Failed to find cell at ${row}, ${col}. Range: ${valueRange.range}. Sheet dimensions: ${sheetRows}x${sheetCols}.`
)
} }
values.push(this.cellValue(cell)) values.push(this.cellValue(cell))
} }