commit 974ef6c06711e685704e9afa90b04d3af2988804
parent 32faf7062316aecd95b90f0aeb97a34dcc2a302e
Author: Andy Herbert <andy.herbert@gmail.com>
Date: Tue, 5 Nov 2013 20:37:32 +0000
Handle exceptions thrown in the render function.
Diffstat:
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/ansilove.js b/ansilove.js
@@ -1260,8 +1260,6 @@ var AnsiLove = (function () {
default:
if (callbackFail) {
callbackFail(http.status);
- } else {
- throw ("Could not retrieve: " + url);
}
}
}
@@ -1721,12 +1719,20 @@ var AnsiLove = (function () {
return {
"render": function (url, callback, options, callbackFail) {
httpGet(url, function (bytes) {
- render(url, bytes, callback, 0, options || {});
+ try {
+ render(url, bytes, callback, 0, options || {});
+ } catch (e) {
+ callbackFail(e);
+ }
}, callbackFail);
},
"splitRender": function (url, callback, splitRows, options, callbackFail) {
httpGet(url, function (bytes) {
- render(url, bytes, callback, splitRows || 27, options || {});
+ try {
+ render(url, bytes, callback, splitRows || 27, options || {});
+ } catch (e) {
+ callbackFail(e);
+ }
}, callbackFail);
},
"renderBytes": function (bytes, callback, options) {