On page:
- styled to use proper line breaks
- "centered" by .container class and not by huge padding

Console:
- proper line breaks
- links in stack trace are clickable(Chrome)
--
Petr Vobornik
From 07c8d59e0162a5011ef24db7b4e256ca2af6b0e3 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Tue, 29 Jul 2014 14:13:10 +0200
Subject: [PATCH] webui: better error reporting

On page:
- styled to use proper line breaks
- "centered" by .container class and not by huge padding

Console:
- proper line breaks
- links in stack trace are clickable(Chrome)
---
 install/ui/ipa.css                               |  6 ++++--
 install/ui/src/freeipa/Application_controller.js | 20 ++++++++++----------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/install/ui/ipa.css b/install/ui/ipa.css
index 2e70a1adc9c97fd9930925adbe6a76b778022eb6..e02e282e3b1150ae184d61e63b6477e31806cde5 100644
--- a/install/ui/ipa.css
+++ b/install/ui/ipa.css
@@ -189,7 +189,6 @@ div[name=settings].facet-group li a {
 /* --- Facet error --- */
 
 .facet-error {
-    padding: 2em 15em;
     background-color: white;
 }
 
@@ -199,7 +198,10 @@ div[name=settings].facet-group li a {
 
 .facet-error .error-details {
     margin-top: 2em;
-    font-family: monospace;
+}
+
+.facet-error .error-details code {
+    white-space: pre;
 }
 
 /* ---- Search Facet ---- */
diff --git a/install/ui/src/freeipa/Application_controller.js b/install/ui/src/freeipa/Application_controller.js
index bb9d684570b06d5d958bc567186da3a3c7a569fa..094bd3da7c4806a316ebe2589b98a523410f4a5f 100644
--- a/install/ui/src/freeipa/Application_controller.js
+++ b/install/ui/src/freeipa/Application_controller.js
@@ -247,26 +247,26 @@ define([
 
         on_phase_error: function(error) {
 
-            window.console.error(error);
             error = error || {};
             var name = error.name || 'Runtime error';
             var error_container = $('<div/>', {
-                'class': 'facet-content facet-error'
-            }).appendTo($('.content').empty());
+                'class': 'container facet-content facet-error'
+            }).appendTo($('.app-container .content').empty());
             error_container.append('<h1>'+name+'</h1>');
             var details = $('<div/>', {
                 'class': 'error-details'
             }).appendTo(error_container);
 
             details.append('<p> Web UI got in unrecoverable state during "'+error.phase+'" phase.</p>');
-
+            if (error.name) window.console.error(error.name);
             if (error.results) {
-                var msg = {
-                    message: error.results.message,
-                    stack: error.results.stack
-                };
-                details.append('<strong>Technical details:</strong>');
-                details.append('<p>'+JSON.stringify(msg)+'</p>');
+                var msg = error.results.message;
+                var stack = error.results.stack.toString();
+                window.console.error(msg);
+                window.console.error(stack);
+                details.append('<h3>Technical details:</h3>');
+                details.append($('<div/>', { text: error.results.message }));
+                details.append($('<div/>').append($('<code/>', { text: stack })));
             }
         },
 
-- 
1.9.3

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to