Handle [[embed]] errors specifically, instead of whole markdown text erroring
diff --git a/Allura/allura/lib/macro.py b/Allura/allura/lib/macro.py
index a7197de..3e58278 100644
--- a/Allura/allura/lib/macro.py
+++ b/Allura/allura/lib/macro.py
@@ -466,6 +466,9 @@
             html = consumer.embed(url)['html']
         except oembed.OEmbedNoEndpoint:
             html = None
+        except oembed.OEmbedError:
+            log.exception('Could not embed: {}'.format(url))
+            return 'Could not embed: {}'.format(url)
         except six.moves.urllib.error.HTTPError as e:
             if e.code == 404:
                 return 'Video not available'
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 7d624ce..a811247 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -25,13 +25,13 @@
 import allura
 import unittest
 import hashlib
-import datetime as dt
 from mock import patch, Mock
 
 from bson import ObjectId
 from nose.tools import with_setup, assert_equal, assert_in, assert_not_in
 from tg import tmpl_context as c, app_globals as g
 import tg
+from oembed import OEmbedError
 
 from ming.orm import ThreadLocalORMSession
 from alluratest.controller import (
@@ -353,6 +353,14 @@
     assert_equal(r, '<div class="markdown_content"><p>Video not available</p></div>')
 
 
+@patch('oembed.OEmbedEndpoint.fetch')
+def test_macro_embed_video_error(oembed_fetch):
+    oembed_fetch.side_effect = OEmbedError('Invalid mime-type in response...')
+    r = g.markdown_wiki.convert('[[embed url=http://www.youtube.com/watch?v=6YbBmqUnoQM]]')
+    assert_equal(r, '<div class="markdown_content"><p>Could not embed: '
+                    'http://www.youtube.com/watch?v=6YbBmqUnoQM</p></div>')
+
+
 def test_macro_embed_notsupported():
     r = g.markdown_wiki.convert('[[embed url=http://vimeo.com/46163090]]')
     assert_equal(