From ef3733aebee31ac55b098110903c753adbc8c0e3 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 20 Dec 2013 12:54:38 +0100 Subject: [PATCH] Improve error on attempt to delete missing template --- lib/cartodb/template_maps.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cartodb/template_maps.js b/lib/cartodb/template_maps.js index 829a2fea..e1019f24 100644 --- a/lib/cartodb/template_maps.js +++ b/lib/cartodb/template_maps.js @@ -291,6 +291,9 @@ o.delTemplate = function(owner, tpl_id, callback) { }, function delCertificate(err, tplval) { if ( err ) throw err; + if ( ! tplval ) { + throw new Error("Template '" + tpl_id + "' of user '" + owner + "' does not exist"); + } var tpl = JSON.parse(tplval); if ( ! tpl.auth_id ) { // not sure this is an error, in case we'll ever