Skip to content

Commit

Permalink
fix: fix query filters check error message
Browse files Browse the repository at this point in the history
  • Loading branch information
pviti committed Oct 30, 2024
1 parent 1c7782f commit 0c96b16
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ const generateQueryStringParams = <R extends Resource>(params: QueryParams<R> |
Object.entries(params.filters).forEach(([p, v]) => {
let val
if (Array.isArray(v)) {
if (!isArrayFilter(p)) throw new SdkError({ message: `Incorrect filter: Array value is supported only for the following filters: ${arrayFilters.join(', ')}`, type: ErrorType.REQUEST })
if (!isArrayFilter(p)) throw new SdkError({ message: `Incorrect filter [${p}]: Array value is supported only for the following filters: ${arrayFilters.join(', ')}`, type: ErrorType.REQUEST })
val = v.join(',')
}
else if (typeof v === 'object') {
if (!isObjectFilter(p)) throw new SdkError({ message: `Incorrect filter: Object value is supported only for the following filters: ${objectFilters.join(', ')}`, type: ErrorType.REQUEST })
if (!isObjectFilter(p)) throw new SdkError({ message: `Incorrect filter [${p}]: Object value is supported only for the following filters: ${objectFilters.join(', ')}`, type: ErrorType.REQUEST })
val = JSON.stringify(v)
}
else val = String(v)
Expand Down

0 comments on commit 0c96b16

Please sign in to comment.