-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSubmitChangesErrorHandling
More file actions
53 lines (53 loc) · 1.4 KB
/
SubmitChangesErrorHandling
File metadata and controls
53 lines (53 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
this.getView().getModel().submitChanges({
success: function(context) {
//Batch request will always endup here.
//Check for error again.
if (context.__batchResponses[0].hasOwnProperty("response")) {
if (context.__batchResponses[0].response.statusCode === "400") {
//oModel.resetChanges(); //Data is set back to original.
var error = jQuery.parseJSON(context.__batchResponses[0].response.body).error.message.value;
var dialog = new sap.m.Dialog({
title: "Error",
type: "Message",
state: "Error",
content: new sap.m.Text({
text: error
}),
beginButton: new sap.m.Button({
text: "OK",
press: function() {
dialog.close();
}
}),
afterClose: function() {
dialog.destroy();
}
});
dialog.open();
}
} else {
var msg = "Reallocation was suuceesful";
MessageToast.show(msg);
}
},
error: function(error) {
var dialog = new sap.m.Dialog({
title: "Error",
type: "Message",
state: "Error",
content: new sap.m.Text({
text: "Failed to reallocate"
}),
beginButton: new sap.m.Button({
text: "OK",
press: function() {
dialog.close();
}
}),
afterClose: function() {
dialog.destroy();
}
});
dialog.open();
}
});