           reject "Insufficient arguments. Need either URL, or all of: data, type, md5sum and filename"
 
         if url?
-          downloaded = @_getRemoteMedia url
+          @_getRemoteMedia url
             .then @writeMedia.bind @
-          resolve downloaded
+            .then resolve
+            .error (error) =>
+              console.error red "Error downloading file: #{url}\n", error
+              reject error
         else if @media[md5sum]?
           log "using existing media file: #{filename}, #{@media[md5sum].link}"
           resolve

            post_thumbnail: featuredImage.id
            post_status: if article.draft then 'draft' else 'publish'
            post_name: article.slug
            terms_names:
              category: [@categories[article.category]]
              post_tag: ['ewao-archive']

          debug 'url', url
          mediaLoaded.push @writeMedia {url}

      # once all media has been loaded (or failed)
      Promise.settle mediaLoaded
        .then (media) => # replace media urls in article
          for file in media
            if file.isFulfilled()
              file = file.value()
              article.content = article.content.replace new RegExp(escapeStringRegexp file.origUrl), file.url
            else
              console.error red "Article has missing media: #{article.title}"
          media
        .then (media) => # write article to wordpress
          featuredImage = if media[0].isFulfilled() then media[0].value() else {}
          data =
            post_type:    'post'
            post_status:  'publish'
