Fixes RPC server's JSON encoding of exception's name.

It allows to show the name in Web UI's error dialog title.
--
Petr Vobornik
From 6034ef0e752f6b380f60a5a5299db972b86dc932 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <[email protected]>
Date: Thu, 22 Aug 2013 13:48:44 +0200
Subject: [PATCH] Show human-readable error name in error dialog title

Fixes RPC server's JSON encoding of exception's name.

It allows to show the name in Web UI's error dialog title.
---
 install/ui/src/freeipa/ipa.js | 3 ++-
 ipaserver/rpcserver.py        | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/install/ui/src/freeipa/ipa.js b/install/ui/src/freeipa/ipa.js
index 8d54b66e063747fe434085cbe2afbdc7d3c605f8..0e9fdefb98cbc18cfe346c0a2daa7e7d4f70dafa 100644
--- a/install/ui/src/freeipa/ipa.js
+++ b/install/ui/src/freeipa/ipa.js
@@ -733,7 +733,8 @@ IPA.command = function(spec) {
             } else if (data.error) {
                 // error_handler() calls IPA.hide_activity_icon()
                 error_handler.call(this, xhr, text_status,  /* error_thrown */ {
-                    name: text.get('@i18n:errors.ipa_error', 'IPA Error')+' '+data.error.code,
+                    name: text.get('@i18n:errors.ipa_error', 'IPA Error') + ' ' +
+                          data.error.code + ': ' + data.error.name,
                     code: data.error.code,
                     message: data.error.message,
                     data: data
diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py
index eb9b0734ac4956cb0e65664ae1cb4004d72020de..0ec7b02d2c833086803459a5cad1bbcea9d121e2 100644
--- a/ipaserver/rpcserver.py
+++ b/ipaserver/rpcserver.py
@@ -516,7 +516,7 @@ class jsonserver(WSGIExecutioner, HTTP_Status):
             error = dict(
                 code=error.errno,
                 message=error.strerror,
-                name=error.__class__.__name__,
+                name=unicode(error.__class__.__name__),
             )
         principal = getattr(context, 'principal', 'UNKNOWN')
         response = dict(
-- 
1.8.3.1

_______________________________________________
Freeipa-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to