diff --git a/structr-ui/src/main/java/org/structr/web/resource/LoginResource.java b/structr-ui/src/main/java/org/structr/web/resource/LoginResource.java
index <HASH>..<HASH> 100644
--- a/structr-ui/src/main/java/org/structr/web/resource/LoginResource.java
+++ b/structr-ui/src/main/java/org/structr/web/resource/LoginResource.java
@@ -158,7 +158,7 @@ public class LoginResource extends FilterableResource {
 
 		if (returnedMethodResult == null) {
 			// should not happen
-			returnedMethodResult = new RestMethodResult(401);
+			throw new AuthenticationException(AuthHelper.STANDARD_ERROR_MSG);
 		}
 
 		return returnedMethodResult;
Minor: Do not return empty result for login action with empty username and password