Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java @ 3698:8e69aca69074
Catch MissingResourceException on unexpected server exceptions.
flys-client/trunk@5408 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Sun, 09 Sep 2012 10:03:19 +0000 |
parents | a050cb5f303f |
children | 436eec3be6ff |
comparison
equal
deleted
inserted
replaced
3697:2e12518ff5b4 | 3698:8e69aca69074 |
---|---|
38 import de.intevation.flys.client.shared.model.River; | 38 import de.intevation.flys.client.shared.model.River; |
39 import de.intevation.flys.client.shared.model.User; | 39 import de.intevation.flys.client.shared.model.User; |
40 | 40 |
41 import java.util.ArrayList; | 41 import java.util.ArrayList; |
42 import java.util.List; | 42 import java.util.List; |
43 import java.util.MissingResourceException; | |
43 import java.util.Set; | 44 import java.util.Set; |
44 | 45 |
45 | 46 |
46 /** | 47 /** |
47 * Entry point classes define <code>onModuleLoad()</code>. | 48 * Entry point classes define <code>onModuleLoad()</code>. |
135 initConfiguration(); | 136 initConfiguration(); |
136 | 137 |
137 Config config = Config.getInstance(); | 138 Config config = Config.getInstance(); |
138 String locale = config.getLocale(); | 139 String locale = config.getLocale(); |
139 | 140 |
140 getRivers(); // Useless call? | |
141 | |
142 userService.getCurrentUser(locale, new AsyncCallback<User>() { | 141 userService.getCurrentUser(locale, new AsyncCallback<User>() { |
143 @Override | 142 @Override |
144 public void onFailure(Throwable caught) { | 143 public void onFailure(Throwable caught) { |
145 GWT.log("Could not find a logged in user."); | 144 GWT.log("Could not find a logged in user."); |
146 SC.warn(MSG.getString(caught.getMessage())); | 145 String msg = caught.getLocalizedMessage(); |
146 try { | |
147 msg = MSG.getString(caught.getMessage()); | |
148 } | |
149 catch(MissingResourceException ex) { | |
150 // There are some server error exceptions with | |
151 // varying text messages that cannot be localized | |
152 // easily. In this rare cases, use the plain | |
153 // exception message. | |
154 GWT.log("Missing resource for: " + caught.getMessage()); | |
155 } | |
156 SC.warn(msg); | |
147 } | 157 } |
148 | 158 |
149 @Override | 159 @Override |
150 public void onSuccess(User user) { | 160 public void onSuccess(User user) { |
151 GWT.log("Found a user. Set '"+ user.getName() + "'"); | 161 GWT.log("Found a user. Set '"+ user.getName() + "'"); |