瀏覽代碼

add custom exception for unsupported http method call

David Luhmer 6 年之前
父節點
當前提交
97b924d545

+ 1 - 0
src/main/java/com/nextcloud/android/sso/Constants.java

@@ -10,4 +10,5 @@ public class Constants {
     // Custom Exceptions
     public static final String EXCEPTION_INVALID_TOKEN = "CE_1";
     public static final String EXCEPTION_ACCOUNT_NOT_FOUND = "CE_2";
+    public static final String EXCEPTION_UNSUPPORTED_METHOD = "CE_3";
 }

+ 2 - 1
src/main/java/com/nextcloud/android/sso/InputStreamBinder.java

@@ -63,6 +63,7 @@ import java.util.Map;
 
 import static com.nextcloud.android.sso.Constants.EXCEPTION_ACCOUNT_NOT_FOUND;
 import static com.nextcloud.android.sso.Constants.EXCEPTION_INVALID_TOKEN;
+import static com.nextcloud.android.sso.Constants.EXCEPTION_UNSUPPORTED_METHOD;
 
 
 /**
@@ -200,7 +201,7 @@ public class InputStreamBinder extends IInputStreamService.Stub {
                 break;
 
             default:
-                throw new UnsupportedOperationException("Unexpected type!!");
+                throw new UnsupportedOperationException(EXCEPTION_UNSUPPORTED_METHOD);
 
         }