Minify module

basic framework for more human-readable error responses from the bitly minifier
This commit is contained in:
Scritches 2018-03-26 16:23:03 -04:00
parent 19cc4c474d
commit 43cfe3b637

View File

@ -26,7 +26,14 @@ var minify = function(dbot) {
if (body.status_code == 200) { if (body.status_code == 200) {
callback(body.data.url); callback(body.data.url);
} else { } else {
callback(false, body.status_txt); var emsg = function() {
switch(body.status_txt) {
case "INVALID_URI": return "Invalid URL was supplied";
default: return body.status_txt;
}
}
callback(false, emsg);
} }
} else { } else {
callback(false, error); callback(false, error);