 
     res.redirect("/themes/#{theTheme.id}")
 
-  ).fail((err) ->
+  ).catch((err) ->
     console.error err
     return res.render(500, "Error fetching the theme")
   )

_ = require('underscore')
async = require('async')
Q = require('q')
Promise = require('bluebird')

Indicator = require('../models/indicator').model

exports.discardDraft = (req, res) ->
  theTheme = null

  themeFinder = Theme.findOne(_id: req.params.id).populate('owner')
  Promise.promisify(
    themeFinder.exec,
    themeFinder
  )().then( (theme) ->
    theTheme = theme

    unless theme?
