     deferred = Q.defer()
     query = encodeURIComponent("key=\"#{channelKey}\"")
     rest.GET "/channels?where=#{query}", (error, response, body) ->
-      if error
-        deferred.reject 'Error on getting channel: ' + error
+      if error?
+        deferred.reject "Error on getting channel: #{error}"
       else if response.statusCode isnt 200
         humanReadable = JSON.stringify body, null, 2
-        deferred.reject 'Problem on getting channel: ' + humanReadable
+        deferred.reject "Problem on getting channel: #{humanReadable}"
       else
         channels = body.results
         if _.size(channels) is 1

    deferred = Q.defer()
    @sync.buildActions(entry, existingEntry).update (error, response, body) =>
      @tickProgress()
      if error
        deferred.reject 'Error on updating inventory entry: ' + error
      else
        if response.statusCode is 200
          deferred.resolve 'Inventory entry updated.'

          deferred.resolve 'Inventory entry update not neccessary.'
        else
          humanReadable = JSON.stringify body, null, 2
          deferred.reject "Problem on updating existing inventory entry: #{humanReadable}"
    deferred.promise

  create: (stock) ->
    deferred = Q.defer()
    @rest.POST '/inventory', stock, (error, response, body) =>
      @tickProgress()
      if error?
        deferred.reject "Error on creating new inventory entry: #{error}"
      else
        if response.statusCode is 201
          deferred.resolve 'New inventory entry created.'
        else
          humanReadable = JSON.stringify body, null, 2
          deferred.reject "Problem on creating new inventory entry: #{humanReadable}"
    deferred.promise

###
