@@ -125,6 +125,11 @@ public async Task FlushAsync(CancellationToken cancellationToken = default)
125125 this . _rows . Clear ( ) ;
126126 }
127127 }
128+ catch ( Exception ex )
129+ {
130+ TelemetryInstance . TrackException ( TelemetryErrorName . FlushAsync , ex ) ;
131+ throw ;
132+ }
128133 finally
129134 {
130135 this . _rowLock . Release ( ) ;
@@ -177,7 +182,7 @@ private async Task UpsertRowsAsync(IEnumerable<T> rows, SqlAttribute attribute,
177182 {
178183 string message = $ "The following properties in { typeof ( T ) } do not exist in the table { fullTableName } : { string . Join ( ", " , extraProperties . ToArray ( ) ) } .";
179184 var ex = new InvalidOperationException ( message ) ;
180- TelemetryInstance . TrackError ( TelemetryErrorName . PropsNotExistOnTable , ex , props ) ;
185+ TelemetryInstance . TrackException ( TelemetryErrorName . PropsNotExistOnTable , ex , props ) ;
181186 throw ex ;
182187 }
183188
@@ -214,12 +219,12 @@ private async Task UpsertRowsAsync(IEnumerable<T> rows, SqlAttribute attribute,
214219 {
215220 try
216221 {
217- TelemetryInstance . TrackError ( TelemetryErrorName . Upsert , ex , props ) ;
222+ TelemetryInstance . TrackException ( TelemetryErrorName . Upsert , ex , props ) ;
218223 transaction . Rollback ( ) ;
219224 }
220225 catch ( Exception ex2 )
221226 {
222- TelemetryInstance . TrackError ( TelemetryErrorName . UpsertRollback , ex2 , props ) ;
227+ TelemetryInstance . TrackException ( TelemetryErrorName . UpsertRollback , ex2 , props ) ;
223228 string message2 = $ "Encountered exception during upsert and rollback.";
224229 throw new AggregateException ( message2 , new List < Exception > { ex , ex2 } ) ;
225230 }
@@ -467,7 +472,7 @@ public static async Task<TableInformation> RetrieveTableInformationAsync(SqlConn
467472 // Since this doesn't rethrow make sure we stop here too (don't use finally because we want the execution time to be the same here and in the
468473 // overall event but we also only want to send the GetCaseSensitivity event if it succeeds)
469474 caseSensitiveSw . Stop ( ) ;
470- TelemetryInstance . TrackError ( TelemetryErrorName . GetCaseSensitivity , ex , sqlConnProps ) ;
475+ TelemetryInstance . TrackException ( TelemetryErrorName . GetCaseSensitivity , ex , sqlConnProps ) ;
471476 logger . LogWarning ( $ "Encountered exception while retrieving database collation: { ex } . Case insensitive behavior will be used by default.") ;
472477 }
473478
@@ -490,7 +495,7 @@ public static async Task<TableInformation> RetrieveTableInformationAsync(SqlConn
490495 }
491496 catch ( Exception ex )
492497 {
493- TelemetryInstance . TrackError ( TelemetryErrorName . GetColumnDefinitions , ex , sqlConnProps ) ;
498+ TelemetryInstance . TrackException ( TelemetryErrorName . GetColumnDefinitions , ex , sqlConnProps ) ;
494499 // Throw a custom error so that it's easier to decipher.
495500 string message = $ "Encountered exception while retrieving column names and types for table { table } . Cannot generate upsert command without them.";
496501 throw new InvalidOperationException ( message , ex ) ;
@@ -500,7 +505,7 @@ public static async Task<TableInformation> RetrieveTableInformationAsync(SqlConn
500505 {
501506 string message = $ "Table { table } does not exist.";
502507 var ex = new InvalidOperationException ( message ) ;
503- TelemetryInstance . TrackError ( TelemetryErrorName . GetColumnDefinitionsTableDoesNotExist , ex , sqlConnProps ) ;
508+ TelemetryInstance . TrackException ( TelemetryErrorName . GetColumnDefinitionsTableDoesNotExist , ex , sqlConnProps ) ;
504509 throw ex ;
505510 }
506511
@@ -521,7 +526,7 @@ public static async Task<TableInformation> RetrieveTableInformationAsync(SqlConn
521526 }
522527 catch ( Exception ex )
523528 {
524- TelemetryInstance . TrackError ( TelemetryErrorName . GetPrimaryKeys , ex , sqlConnProps ) ;
529+ TelemetryInstance . TrackException ( TelemetryErrorName . GetPrimaryKeys , ex , sqlConnProps ) ;
525530 // Throw a custom error so that it's easier to decipher.
526531 string message = $ "Encountered exception while retrieving primary keys for table { table } . Cannot generate upsert command without them.";
527532 throw new InvalidOperationException ( message , ex ) ;
@@ -531,7 +536,7 @@ public static async Task<TableInformation> RetrieveTableInformationAsync(SqlConn
531536 {
532537 string message = $ "Did not retrieve any primary keys for { table } . Cannot generate upsert command without them.";
533538 var ex = new InvalidOperationException ( message ) ;
534- TelemetryInstance . TrackError ( TelemetryErrorName . NoPrimaryKeys , ex , sqlConnProps ) ;
539+ TelemetryInstance . TrackException ( TelemetryErrorName . NoPrimaryKeys , ex , sqlConnProps ) ;
535540 throw ex ;
536541 }
537542
@@ -548,7 +553,7 @@ public static async Task<TableInformation> RetrieveTableInformationAsync(SqlConn
548553 {
549554 string message = $ "All primary keys for SQL table { table } need to be found in '{ typeof ( T ) } .' Missing primary keys: [{ string . Join ( "," , missingPrimaryKeysFromPOCO ) } ]";
550555 var ex = new InvalidOperationException ( message ) ;
551- TelemetryInstance . TrackError ( TelemetryErrorName . MissingPrimaryKeys , ex , sqlConnProps ) ;
556+ TelemetryInstance . TrackException ( TelemetryErrorName . MissingPrimaryKeys , ex , sqlConnProps ) ;
552557 throw ex ;
553558 }
554559
0 commit comments