Move creation of error JSON object to JSON page.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / ajax / JsonPage.java
index e8cd3d5..27fa081 100644 (file)
@@ -146,6 +146,21 @@ public abstract class JsonPage implements Page {
        }
 
        //
+       // PROTECTED METHODS
+       //
+
+       /**
+        * Creates an error reply.
+        *
+        * @param error
+        *            The error that has occured
+        * @return The JSON object, signalling failure and the error code
+        */
+       protected JsonObject createErrorJsonObject(String error) {
+               return new JsonObject().put("success", false).put("error", error);
+       }
+
+       //
        // PAGE METHODS
        //