Improve error on attempt to delete missing template

This commit is contained in:
Sandro Santilli 2013-12-20 12:54:38 +01:00
parent b5f54ff534
commit ef3733aebe

View File

@ -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