   request options, (error, response, releases=[]) ->
     if error? or response.statusCode isnt 200
       logError('Fetching releases failed', error, releases)
-      callback(error ? response.statusCode)
+      callback(error ? new Error(response.statusCode))
     else
       if releases.length > maxReleases
         deleteRelease(release) for release in releases[maxReleases..]

  assetRequest = request options, (error, response, body='') ->
    if error? or response.statusCode >= 400
      logError('Upload release asset failed', error, body)
      callback(error ? response.statusCode)
    else
      callback(null, release)


  request options, (error, response, body={}) ->
    if error? or response.statusCode isnt 200
      logError('Creating release failed', error, body)
      callback(error ? new Error(response.statusCode))
    else
      callback()
