mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
![]() # Aider chat conversation: USER: if the fetch fails, skip the rest ASSISTANT: To handle fetch failures, we need to modify the `share/index.md` file. We will add a `.catch` block to the fetch promise chain to handle any errors that occur during the fetch operation. Here is the proposed change: ```markdown share/index.md <<<<<<< ORIGINAL fetch(conv) .then(response => response.text()) .then(markdown => { // Ensure every line that starts with '>' ends with exactly 2 spaces markdown = markdown.split('\n').map(function(line) { if (line.startsWith('>')) { return line.trimEnd() + ' '; } return line; }).join('\n'); var html = marked.parse(markdown); var divElement = document.querySelector('.chat-transcript'); divElement.innerHTML = html; }); ======= fetch(conv) .then(response => response.text()) .then(markdown => { // Ensure every line that starts with '>' ends with exactly 2 spaces markdown = markdown.split('\n').map(function(line) { if (line.startsWith('>')) { return line.trimEnd() + ' '; } return line; }).join('\n'); var html = marked.parse(markdown); var divElement = document.querySelector('.chat-transcript'); divElement.innerHTML = html; }) .catch(error => { console.error('Error fetching markdown:', error); }); >>>>>>> UPDATED ``` This change adds a `.catch` block to the fetch promise chain. If an error occurs during the fetch operation, the error will be logged to the console and the rest of the script will be skipped. |
||
---|---|---|
.. | ||
index.md |