Prevent exception when panel has multiple queries (#49368)

This fixes the issues that when a panel has multiple queries this throws an exception if source is not part of the current frame

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Ward Bekker 2022-05-25 09:13:43 +02:00 committed by GitHub
parent bb4a834ee3
commit eab806620c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,8 @@ function addExtractedFields(frame: DataFrame, options: ExtractFieldsOptions): Da
}
const source = findField(frame, options.source);
if (!source) {
throw new Error('json field not found');
// this case can happen when there are multiple queries
return frame;
}
const ext = fieldExtractors.getIfExists(options.format ?? FieldExtractorID.Auto);