Transforms: Catch errors while running transforms (#73451)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
import { Observable, of, ReplaySubject, Unsubscribable } from 'rxjs';
|
import { Observable, of, ReplaySubject, Unsubscribable } from 'rxjs';
|
||||||
import { map, mergeMap } from 'rxjs/operators';
|
import { map, mergeMap, catchError } from 'rxjs/operators';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ApplyFieldOverrideOptions,
|
ApplyFieldOverrideOptions,
|
||||||
@@ -221,7 +221,17 @@ export class PanelQueryRunner {
|
|||||||
interpolate: (v: string) => getTemplateSrv().replace(v, data?.request?.scopedVars),
|
interpolate: (v: string) => getTemplateSrv().replace(v, data?.request?.scopedVars),
|
||||||
};
|
};
|
||||||
|
|
||||||
return transformDataFrame(transformations, data.series, ctx).pipe(map((series) => ({ ...data, series })));
|
return transformDataFrame(transformations, data.series, ctx).pipe(
|
||||||
|
map((series) => ({ ...data, series })),
|
||||||
|
catchError((err) => {
|
||||||
|
console.warn('Error running transformation:', err);
|
||||||
|
return of({
|
||||||
|
...data,
|
||||||
|
state: LoadingState.Error,
|
||||||
|
error: toDataQueryError(err),
|
||||||
|
});
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(options: QueryRunnerOptions) {
|
async run(options: QueryRunnerOptions) {
|
||||||
|
|||||||
Reference in New Issue
Block a user