Skip to content

Commit b9cd891

Browse files
committed
fix: try catch toHtml
1 parent 9a68bc8 commit b9cd891

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/script-view.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,13 @@ export default class ScriptView extends MessagePanelView {
173173
line = _.escape(line);
174174
}
175175

176-
line = this.ansiFilter.toHtml(line);
176+
try {
177+
line = this.ansiFilter.toHtml(line);
178+
} catch (e) {
179+
// TODO why this happens https://github.com/atom-community/atom-script/issues/2358
180+
console.error(e);
181+
}
182+
177183
line = linkPaths(line);
178184

179185
const { clientHeight, scrollTop, scrollHeight } = this.body[0];

spec/fixtures/issue_2358.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# See the console after running this
2+
3+
import requests
4+
5+
head = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/65.0.3325.181 Chrome/65.0.3325.181 Safari/537.36'}
6+
7+
r = requests.get('https://www.oxfordlearnersdictionaries.com/us/wordlists/oxford3000-5000', headers=head)
8+
9+
print(r.text)

0 commit comments

Comments
 (0)