Skip to content

Commit

Permalink
Return error instead
Browse files Browse the repository at this point in the history
  • Loading branch information
briantu committed Nov 21, 2024
1 parent 35fba08 commit 1a3b80c
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ export const parseAssetSelectionQuery = (
export const filterAssetSelectionByQuery = (
all_assets: AssetGraphQueryItem[],
query: string,
): AssetSelectionQueryResult =>
featureEnabled(FeatureFlag.flagAssetSelectionSyntax)
? parseAssetSelectionQuery(all_assets, query)
: filterByQuery(all_assets, query);
): AssetSelectionQueryResult => {
if (featureEnabled(FeatureFlag.flagAssetSelectionSyntax)) {
const result = parseAssetSelectionQuery(all_assets, query);
if (result instanceof Error) {
// fall back to old behavior
return filterByQuery(all_assets, query);
}
return result;
}
return filterByQuery(all_assets, query);
};

0 comments on commit 1a3b80c

Please sign in to comment.