import { InteractionLock } from "./interactionLock" ; param mod param rowLimit export function generalErrorHandler < T extends ( dataView : Spotfire . DataView , ... args : any ) => any > ( mod , rowLimit = 2000 , interactionLock ? ) { return function ( callback ) { return async function callbackWrapper ( dataView , ... args ) { try { await interactionLock ?. interactionInProgress ( ) ; const errors = await dataView . getErrors ( ) ; if ( errors . length > 0 ) { mod . controls . errorOverlay . show ( errors , "DataView" ) ; return ; } mod . controls . errorOverlay . hide ( "DataView" ) ; /**
                 * Hard abort if row count exceeds an arbitrary selected limit
                 */ const rowCount = await dataView . rowCount ( ) ; if ( rowCount && rowCount > rowLimit ) { mod . controls . errorOverlay . show ( `☹️ Cannot render - too many rows (rowCount: ${ rowCount }, limit: ${ rowLimit }) ` , "General" ) ; return ; } /**
                 * User interaction while rows were fetched. Return early and respond to next subscribe callback.
                 */ const allRows = await dataView . allRows ( ) ; if ( allRows == null ) { return ; } await callback ( dataView , ... args ) ; mod . controls . errorOverlay . hide ( "General" ) ; } catch ( e ) { mod . controls . errorOverlay . show ( e . message || e || "☹️ Something went wrong, check developer console" , "General" ) ; console . error ( e ) ; } } as T ; } ; }