[Lada-commits] [PATCH 1 of 2] Better Error handling

Wald Commits scm-commit at wald.intevation.org
Fri Jul 10 17:28:42 CEST 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1436530919 -7200
# Node ID dff2798390f82e6a27c744f4ccd544633d5e3132
# Parent  a031b98c7edc9b39b3b9e0d73a8b1609f6da766c
Better Error handling

diff -r a031b98c7edc -r dff2798390f8 app/view/window/GenProbenFromMessprogramm.js
--- a/app/view/window/GenProbenFromMessprogramm.js	Fri Jul 10 10:20:13 2015 +0200
+++ b/app/view/window/GenProbenFromMessprogramm.js	Fri Jul 10 14:21:59 2015 +0200
@@ -69,7 +69,14 @@
                         });
                     },
                     failure: function(response) {
-                        var json = Ext.JSON.decode(response.responseText);
+                        var json = null;
+                        try {
+                            json = Ext.JSON.decode(response.responseText);
+                        }
+                        catch(err){
+                            Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title'),
+                                Lada.getApplication().bundle.getMsg('err.msg.response.body'));
+                        }
                         if (json) {
                             if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
                                 formPanel.setMessages(json.errors, json.warnings);


More information about the Lada-commits mailing list