From 43cfe3b637a718e34fc2c92979e2f67d1fecddc2 Mon Sep 17 00:00:00 2001 From: Scritches Date: Mon, 26 Mar 2018 16:23:03 -0400 Subject: [PATCH] Minify module basic framework for more human-readable error responses from the bitly minifier --- modules/minify/minify.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/minify/minify.js b/modules/minify/minify.js index f2bc9cb..ee72094 100644 --- a/modules/minify/minify.js +++ b/modules/minify/minify.js @@ -26,7 +26,14 @@ var minify = function(dbot) { if (body.status_code == 200) { callback(body.data.url); } 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 { callback(false, error);