From aa3aa952bee3cf9fb137edfef420fe6245b128eb Mon Sep 17 00:00:00 2001 From: Joel Uong Date: Tue, 30 Jan 2024 17:50:11 -0500 Subject: [PATCH] change error to warning for invalid query param --- README.md | 4 ++-- templates/operations.ts.hbs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c4105250..e8a933bc 100644 --- a/README.md +++ b/README.md @@ -222,12 +222,12 @@ const searchResults = await searchClient.productSearch({ parameters: { q: "dress", limit: 5, - c_customQueryParam: '' + c_paramkey: '' } }); ``` -Invalid query parameters that are not a part of the API and do not follow the `c_` custom query parameter convention will be filtered from the request have an error thrown. +Invalid query parameters that are not a part of the API and do not follow the `c_` custom query parameter convention will be filtered from the request and a warning will be displayed. ## Caching diff --git a/templates/operations.ts.hbs b/templates/operations.ts.hbs index 4593b926..d4da8e51 100644 --- a/templates/operations.ts.hbs +++ b/templates/operations.ts.hbs @@ -156,7 +156,7 @@ if(key.startsWith('c_') && optionParams[key] !== undefined) { queryParams[key] = optionParams[key] } else if(!queryParams.hasOwnProperty(key) && !pathParams.hasOwnProperty(key)) { - throw new Error(`Invalid Parameter: ${key}`) + console.warn(`Invalid Parameter: ${key}`) } })