PDA

View Full Version : [CLOSED] Exception handling with GridPanel



ermanni.info
Feb 09, 2014, 9:38 PM
Hi!

How do I customize the exception handling when I'm with GridPanel on maintenance?

My grids treat data recording via Store.BeforeStoreChangedEventHandler. When an exception is generated by the application layer of the same field is displayed in a window with a hard Json content understanding by the user.

I want to create a custom window, displaying the message generated by the domain layer and a link to more details where one would display stacktrace + InnerException.

How to do this?

Thanks!

Ermanni Info

geoffrey.mcgill
Feb 10, 2014, 3:55 AM
How about catching the Exception and displaying a Window or X.Msg.Notify() to the user?

ermanni.info
Feb 10, 2014, 10:02 AM
Hi Geoffrey,

It's a possibility but I want to build a generic routine without having to go through all my forms reprogramming this feature.

Would like to override the default window that displays Ext.Net errors. It returns a status and an error code. Could there be a friendlier option for the user.

This is what I am seeking. Other suggestions?

Thanks!

Ermanni Info

Daniil
Feb 10, 2014, 12:23 PM
Would like to override the default window that displays Ext.Net errors. It returns a status and an error code. Could there be a friendlier option for the user.


For that you could override a DirectEvent's showFailure method. Here is the original code. Please change it as needed.

DirectEvent's showFailure

Ext.net.DirectEvent.showFailure = function (response, errorMsg) {
var bodySize = Ext.getBody().getViewSize(),
width = (bodySize.width < 500) ? bodySize.width - 50 : 500,
height = (bodySize.height < 300) ? bodySize.height - 50 : 300,
win;

if (Ext.isEmpty(errorMsg)) {
errorMsg = response.responseText;
}

win = new Ext.window.Window({
modal: true,
width: width,
height: height,
title: "Request Failure",
layout: "fit",
maximizable: true,
items : [{
xtype:"container",
layout : {
type: "vbox",
align: "stretch"
},
items : [
{
xtype: "container",
height: 42,
layout: "absolute",
defaultType: "label",
items: [
{
xtype : "component",
x : 5,
y : 5,
html : '<div class="x-message-box-error" style="width:32px;height:32px"></div>'
},
{
x : 42,
y : 6,
html : "<b>Status Code: </b>"
},
{
x : 125,
y : 6,
text : response.status
},
{
x : 42,
y : 25,
html : "<b>Status Text: </b>"
},
{
x : 125,
y : 25,
text : response.statusText
}
]
},
{
flex: 1,
itemId : "__ErrorMessageEditor",
xtype : "htmleditor",
value : errorMsg,
readOnly : true,
enableAlignments : false,
enableColors : false,
enableFont : false,
enableFontSize : false,
enableFormat : false,
enableLinks : false,
enableLists : false,
enableSourceEdit : false
}
]
}]
});

win.show();
}