File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ import { type Table } from '../types/io-types/table';
2020import { findLineBounds } from '../util/string-util' ;
2121
2222import { type DebugGranularity } from './debug-configuration' ;
23+ // eslint-disable-next-line unicorn/prefer-node-protocol
24+ import assert from 'assert' ;
2325
2426export class DebugLogVisitor implements IoTypeVisitor < void > {
2527 private readonly PEEK_NUMBER_OF_WORKBOOKS = 5 ;
@@ -57,6 +59,7 @@ export class DebugLogVisitor implements IoTypeVisitor<void> {
5759 }
5860
5961 const row = table . getRow ( i ) ;
62+ assert ( row !== undefined ) ;
6063 const rowData = [ ...row . values ( ) ]
6164 . map ( ( cell ) => {
6265 if ( ERROR_TYPEGUARD ( cell ) ) {
Original file line number Diff line number Diff line change 33// SPDX-License-Identifier: AGPL-3.0-only
44
55// eslint-disable-next-line unicorn/prefer-node-protocol
6- import { strict as assert } from 'assert' ;
6+ import assert from 'assert' ;
77
88import {
99 ERROR_TYPEGUARD ,
@@ -126,12 +126,10 @@ export class Table implements IOTypeImplementation<IOType.TABLE> {
126126 return this . columns . get ( name ) ;
127127 }
128128
129- getRow ( rowId : number ) : TableRow {
129+ getRow ( rowId : number ) : TableRow | undefined {
130130 const numberOfRows = this . getNumberOfRows ( ) ;
131131 if ( rowId >= numberOfRows ) {
132- throw new Error (
133- `Trying to access table row ${ rowId } (of ${ numberOfRows } rows)` ,
134- ) ;
132+ return undefined ;
135133 }
136134
137135 const row = new Map <
@@ -163,6 +161,7 @@ export class Table implements IOTypeImplementation<IOType.TABLE> {
163161 ) : void {
164162 for ( let rowIdx = 0 ; rowIdx < this . numberOfRows ; rowIdx ++ ) {
165163 const row = this . getRow ( rowIdx ) ;
164+ assert ( row !== undefined ) ;
166165
167166 for ( const constraint of this . constraints ) {
168167 if ( constraint . isValid ( row , executionContext ) ) {
You can’t perform that action at this time.
0 commit comments