/* Method used to renew a circulation record based on target_copy_id
* Returns many objects, don't think they are needed
*/
- public void renewCirc(Integer target_copy) throws MaxRenewalsException, SessionNotFoundException, NoNetworkAccessException, NoAccessToServer{
+ public void renewCirc(Integer target_copy) throws MaxRenewalsException,ServerErrorMessage, SessionNotFoundException, NoNetworkAccessException, NoAccessToServer{
HashMap<String,Integer> complexParam = new HashMap<String, Integer>();
complexParam.put("patron", this.userID);
if(resp.get("textcode") != null){
if(resp.get("textcode").equals("MAX_RENEWALS_REACHED"))
throw new MaxRenewalsException();
+ throw new ServerErrorMessage(resp.get("desc").toString());
}
String holdType = (String)holdArhObject.get("hold_type");
String method = null;
-
-
-
+
Object response;
OSRFObject holdInfo = null;
if(holdType.equals("T") || holdType.equals("M")){
--- /dev/null
+package org.evergreen.android.accountAccess;
+
+public class ServerErrorMessage extends Exception{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 3341617529835568018L;
+
+ public String message;
+
+ public ServerErrorMessage(String message){
+ this.message = message;
+ }
+
+}
import org.evergreen.android.R;
import org.evergreen.android.accountAccess.AccountAccess;
import org.evergreen.android.accountAccess.MaxRenewalsException;
+import org.evergreen.android.accountAccess.ServerErrorMessage;
import org.evergreen.android.accountAccess.SessionNotFoundException;
import org.evergreen.android.database.DatabaseManager;
import org.evergreen.android.globals.NoAccessToServer;
progressDialog.dismiss();
Toast.makeText(context,
"Max renewals reached",
- Toast.LENGTH_SHORT).show();
+ Toast.LENGTH_LONG).show();
}
});
refresh = false;
- } catch (SessionNotFoundException e1) {
+ }catch (ServerErrorMessage error) {
+
+ final String errorMessage = error.message;
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ progressDialog.dismiss();
+ Toast.makeText(context,
+ errorMessage,
+ Toast.LENGTH_LONG).show();
+ }
+ });
+ }catch (SessionNotFoundException e1) {
try {
if (accountAccess.authenticate())
ac.renewCirc(record.getTargetCopy());