Skip to content
Browse files

improve view framework error reporting (relates to https://issues.jbo…

  • Loading branch information...
1 parent 930b985 commit c7f9f7c55829f704f5d58bc5b5ccfb553d86ad63 @heiko-braun heiko-braun committed
View
18 gui/src/main/java/org/jboss/as/console/client/shared/viewframework/DmrCallback.java
@@ -44,10 +44,11 @@ public void onFailure(Throwable caught) {
@Override
public void onSuccess(DMRResponse result) {
ModelNode response = result.get();
+
if (response.get(OUTCOME).asString().equals(SUCCESS)) {
onDmrSuccess(response);
} else {
- onDmrFailure(response);
+ onDmrFailure(null, response);
}
}
@@ -56,8 +57,19 @@ public void onSuccess(DMRResponse result) {
* Override this if you want more elaborate handling.
* @param response The full response as a ModelNode.
*/
- public void onDmrFailure(ModelNode response) {
- Console.error(response.get(FAILURE_DESCRIPTION).asString());
+ public void onDmrFailure(ModelNode operation, ModelNode response) {
+
+ String message = null;
+
+ if(response.hasDefined(FAILURE_DESCRIPTION))
+ message = response.get(FAILURE_DESCRIPTION).asString();
+ else if(response.hasDefined("rolled-back"))
+ message = "The operation did fail and has been rolled back: "+response.get("rolled-back").asBoolean();
+
+ if(operation!=null)
+ Console.error(message, "Request:\n"+operation.toString());
+ else
+ Console.error(message);
}
/**
View
6 ...src/main/java/org/jboss/as/console/client/shared/viewframework/EntityToDmrBridgeImpl.java
@@ -255,7 +255,7 @@ protected void refreshView(ModelNode response) {
return entities;
}
- protected void execute(ModelNode operation, final String nameEditedOrAdded, final String successMessage) {
+ protected void execute(final ModelNode operation, final String nameEditedOrAdded, final String successMessage) {
// System.out.println("operation=");
// System.out.println(operation);
dispatcher.execute(new DMRAction(operation), new DmrCallback() {
@@ -269,8 +269,8 @@ public void onDmrSuccess(ModelNode response) {
}
@Override
- public void onDmrFailure(ModelNode response) {
- super.onDmrFailure(response);
+ public void onDmrFailure(ModelNode operation, ModelNode response) {
+ super.onDmrFailure(operation, response);
loadEntities(nameEditedOrAdded);
}
});
View
6 ...in/java/org/jboss/as/console/client/shared/viewframework/SingleEntityToDmrBridgeImpl.java
@@ -119,7 +119,7 @@ public void onSaveDetails(T entity, Map<String, Object> changedValues, ModelNode
if (changedValues.isEmpty())
return;
- ModelNode batch = entityAdapter.fromChangeset(changedValues, resourceAddress, extraSteps);
+ final ModelNode batch = entityAdapter.fromChangeset(changedValues, resourceAddress, extraSteps);
dispatcher.execute(new DMRAction(batch), new DmrCallback() {
@Override
public void onDmrSuccess(ModelNode response) {
@@ -128,8 +128,8 @@ public void onDmrSuccess(ModelNode response) {
}
@Override
- public void onDmrFailure(ModelNode response) {
- super.onDmrFailure(response);
+ public void onDmrFailure(ModelNode operation, ModelNode response) {
+ super.onDmrFailure(batch, response);
loadEntities(null);
}
});

0 comments on commit c7f9f7c

Please sign in to comment.
Something went wrong with that request. Please try again.