Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java @ 4062:145980c21700
Handle error conditions more robust.
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Mon, 08 Oct 2012 12:10:50 +0200 |
parents | ccac1279eb41 |
children | b3bc5e9ba912 |
comparison
equal
deleted
inserted
replaced
4057:c3b959de4d83 | 4062:145980c21700 |
---|---|
102 | 102 |
103 /** This list is used to track the opened projects. */ | 103 /** This list is used to track the opened projects. */ |
104 protected List<String> openProjects; | 104 protected List<String> openProjects; |
105 | 105 |
106 | 106 |
107 protected String getExceptionString(Throwable caught) { | 107 public static String getExceptionString(FLYSConstants msg, Throwable caught) { |
108 try { | 108 try { |
109 return MSG.getString(caught.getMessage()); | 109 return msg.getString(caught.getMessage()); |
110 } | 110 } |
111 catch(MissingResourceException ex) { | 111 catch(MissingResourceException ex) { |
112 // There are some server error exceptions with | 112 // There are some server error exceptions with |
113 // varying text messages that cannot be localized | 113 // varying text messages that cannot be localized |
114 // easily. In this rare cases, use the plain | 114 // easily. In this rare cases, use the plain |
160 | 160 |
161 userService.getCurrentUser(locale, new AsyncCallback<User>() { | 161 userService.getCurrentUser(locale, new AsyncCallback<User>() { |
162 @Override | 162 @Override |
163 public void onFailure(Throwable caught) { | 163 public void onFailure(Throwable caught) { |
164 GWT.log("Could not find a logged in user."); | 164 GWT.log("Could not find a logged in user."); |
165 String msg = getExceptionString(caught); | 165 String msg = getExceptionString(MSG, caught); |
166 SC.warn(msg); | 166 SC.warn(msg); |
167 } | 167 } |
168 | 168 |
169 @Override | 169 @Override |
170 public void onSuccess(User user) { | 170 public void onSuccess(User user) { |
280 | 280 |
281 riverService.list(locale, new AsyncCallback<River[]>() { | 281 riverService.list(locale, new AsyncCallback<River[]>() { |
282 @Override | 282 @Override |
283 public void onFailure(Throwable caught) { | 283 public void onFailure(Throwable caught) { |
284 GWT.log("Could not recieve a list of rivers."); | 284 GWT.log("Could not recieve a list of rivers."); |
285 SC.warn(getExceptionString(caught)); | 285 SC.warn(getExceptionString(MSG, caught)); |
286 } | 286 } |
287 | 287 |
288 @Override | 288 @Override |
289 public void onSuccess(River[] newRivers) { | 289 public void onSuccess(River[] newRivers) { |
290 GWT.log("Retrieved " + newRivers.length + " new rivers."); | 290 GWT.log("Retrieved " + newRivers.length + " new rivers."); |
360 | 360 |
361 describeCollectionService.describe(collectionID, locale, | 361 describeCollectionService.describe(collectionID, locale, |
362 new AsyncCallback<Collection>() { | 362 new AsyncCallback<Collection>() { |
363 @Override | 363 @Override |
364 public void onFailure(Throwable caught) { | 364 public void onFailure(Throwable caught) { |
365 SC.warn(getExceptionString(caught)); | 365 SC.warn(getExceptionString(MSG, caught)); |
366 } | 366 } |
367 | 367 |
368 @Override | 368 @Override |
369 public void onSuccess(Collection c) { | 369 public void onSuccess(Collection c) { |
370 final Collection collection = c; | 370 final Collection collection = c; |
397 item.hash(), | 397 item.hash(), |
398 new AsyncCallback<Artifact>() { | 398 new AsyncCallback<Artifact>() { |
399 @Override | 399 @Override |
400 public void onFailure(Throwable caught) { | 400 public void onFailure(Throwable caught) { |
401 unlockProject(collectionID); | 401 unlockProject(collectionID); |
402 SC.warn(getExceptionString(caught)); | 402 SC.warn(getExceptionString(MSG, caught)); |
403 } | 403 } |
404 | 404 |
405 @Override | 405 @Override |
406 public void onSuccess(Artifact artifact) { | 406 public void onSuccess(Artifact artifact) { |
407 CollectionView view = new CollectionView( | 407 CollectionView view = new CollectionView( |
438 artifactService.create(locale, factory, null, | 438 artifactService.create(locale, factory, null, |
439 new AsyncCallback<Artifact>() { | 439 new AsyncCallback<Artifact>() { |
440 @Override | 440 @Override |
441 public void onFailure(Throwable caught) { | 441 public void onFailure(Throwable caught) { |
442 GWT.log("Could not create the new artifact."); | 442 GWT.log("Could not create the new artifact."); |
443 SC.warn(getExceptionString(caught)); | 443 SC.warn(getExceptionString(MSG, caught)); |
444 } | 444 } |
445 | 445 |
446 @Override | 446 @Override |
447 public void onSuccess(Artifact artifact) { | 447 public void onSuccess(Artifact artifact) { |
448 GWT.log("Successfully created a new artifact."); | 448 GWT.log("Successfully created a new artifact."); |
468 collectionService.create(locale, user.identifier(), | 468 collectionService.create(locale, user.identifier(), |
469 new AsyncCallback<Collection>() { | 469 new AsyncCallback<Collection>() { |
470 @Override | 470 @Override |
471 public void onFailure(Throwable caught) { | 471 public void onFailure(Throwable caught) { |
472 GWT.log("Could not create new collection."); | 472 GWT.log("Could not create new collection."); |
473 SC.warn(getExceptionString(caught)); | 473 SC.warn(getExceptionString(MSG, caught)); |
474 } | 474 } |
475 | 475 |
476 @Override | 476 @Override |
477 public void onSuccess(Collection collection) { | 477 public void onSuccess(Collection collection) { |
478 GWT.log("Successfully created a new collection."); | 478 GWT.log("Successfully created a new collection."); |
481 col, locale, riv, ref, | 481 col, locale, riv, ref, |
482 new AsyncCallback<Artifact>() { | 482 new AsyncCallback<Artifact>() { |
483 @Override | 483 @Override |
484 public void onFailure(Throwable caught) { | 484 public void onFailure(Throwable caught) { |
485 GWT.log("Could not create the new artifact."); | 485 GWT.log("Could not create the new artifact."); |
486 SC.warn(getExceptionString(caught)); | 486 SC.warn(getExceptionString(MSG, caught)); |
487 } | 487 } |
488 | 488 |
489 @Override | 489 @Override |
490 public void onSuccess(Artifact artifact) { | 490 public void onSuccess(Artifact artifact) { |
491 GWT.log("Successfully created a new artifact."); | 491 GWT.log("Successfully created a new artifact."); |