From 07868c729d081098e9548dbc8a23a5fdd27c5504 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Tue, 12 Dec 2023 18:13:38 +0800 Subject: [PATCH] update comments --- packages/api/src/services/library_item.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/api/src/services/library_item.ts b/packages/api/src/services/library_item.ts index fae25fb11..0781d2927 100644 --- a/packages/api/src/services/library_item.ts +++ b/packages/api/src/services/library_item.ts @@ -171,7 +171,7 @@ export const buildQuery = ( expression: ExpressionToken ): string | null => { if (expression.type !== 'LiteralExpression') { - throw new Error('Expected a literal expression.') + throw new Error('Expected a literal expression') } const value = expression.value?.toString() @@ -197,7 +197,7 @@ export const buildQuery = ( const serializeTagExpression = (ast: LiqeQuery): string | null => { if (ast.type !== 'Tag') { - throw new Error('Expected a tag expression.') + throw new Error('Expected a tag expression') } const { field, expression } = ast @@ -351,14 +351,14 @@ export const buildQuery = ( if (start && start !== '*') { startDate = new Date(start) if (isNaN(startDate.getTime())) { - throw new Error('Invalid start date.') + throw new Error('Invalid start date') } } if (end && end !== '*') { endDate = new Date(end) if (isNaN(endDate.getTime())) { - throw new Error('Invalid end date.') + throw new Error('Invalid end date') } } } @@ -410,7 +410,7 @@ export const buildQuery = ( case 'includes': { const ids = value.split(',') if (!ids || ids.length === 0) { - throw new Error('Expected a value.') + throw new Error('Expected ids') } const param = `includes_${parameters.length}` @@ -463,7 +463,7 @@ export const buildQuery = ( const operatorRegex = /([<>]=?)/ const operator = value.match(operatorRegex)?.[0] if (!operator) { - throw new Error('Expected a value.') + throw new Error('Expected operator') } const newValue = value.replace(operatorRegex, '') @@ -499,7 +499,7 @@ export const buildQuery = ( } else if (ast.operator.operator === 'OR') { operator = 'OR' } else { - throw new Error('Unexpected operator.') + throw new Error('Unexpected operator') } const left = serialize(ast.left)