im a bit confused on how to use try, new to javascript so sorry if i explain this poorly,
if (interaction.commandName === "quote") {
fetch("https://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=json&lang=en").then(
async (res) => {
let quote = await res.json();
console.log(quote);
}
);
}```
im making a command that calls an API to give a random quote, it works 99% of the time but when it gives an error like:
```javascript
node_modules\node-fetch\lib\index.js:273
return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));
^
FetchError: invalid json response body at https://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=json&lang=en reason: Bad escaped character in JSON at position 39
at C:\Users\Bubba\Desktop\SakioliBot\node_modules\node-fetch\lib\index.js:273:32
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async C:\Users\Bubba\Desktop\SakioliBot\index.js:328:21 {
type: 'invalid-json'
}```
would i use try to figure this out (ive tried i cant seem to get it)
can anyone help?