Skip to content

Commit

Permalink
change error to warning for invalid query param
Browse files Browse the repository at this point in the history
  • Loading branch information
joeluong-sfcc committed Jan 30, 2024
1 parent 347d1d9 commit aa3aa95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,12 @@ const searchResults = await searchClient.productSearch({
parameters: {
q: "dress",
limit: 5,
c_customQueryParam: '<your-custom-query-param>'
c_paramkey: '<param-value>'
}
});
```

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

Expand Down
2 changes: 1 addition & 1 deletion templates/operations.ts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
}
})

Expand Down

0 comments on commit aa3aa95

Please sign in to comment.