Better logging for freezer ui

Add a LOG.error(error.message) in the shield decorator to save those
logs in case of an exception.

Resolves bug: 1532772

Change-Id: Ic43a5a7eb048512f6079e56e2230aaa954a1449d
This commit is contained in:
Memo García 2016-01-11 11:44:01 +00:00
parent 5639930484
commit 3d7f4226b6
1 changed files with 7 additions and 1 deletions

View File

@ -10,6 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
import datetime
import uuid
import re
@ -23,6 +25,9 @@ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
LOG = logging.getLogger(__name__)
def create_dict(**kwargs):
"""Create a dict only with values that exists so we avoid send keys with
None values
@ -181,7 +186,8 @@ def shield(message, redirect=''):
try:
return function(request, *args, **kwargs)
except Exception:
except Exception as error:
LOG.error(error.message)
namespace = "horizon:disaster_recovery:"
r = reverse("{0}{1}".format(namespace, redirect))
exceptions.handle(request, _(message), redirect=r)