summaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-06-24 10:10:10 +0200
committerVincent Petry <pvince81@owncloud.com>2016-06-24 10:17:12 +0200
commit56ad4cdfec41f5b3dbbca357b4730f7db1700b1e (patch)
tree0184899ebedba5de9f6a87ef974893a60725a169 /apps/dav
parent29068d3845065c3ca873513f3be6d27d886c9874 (diff)
downloadnextcloud-server-56ad4cdfec41f5b3dbbca357b4730f7db1700b1e.tar.gz
nextcloud-server-56ad4cdfec41f5b3dbbca357b4730f7db1700b1e.zip
Show error message when posting an invalid comment
When an internal server error occurs while creating or updating a comment, display a proper error notification in the UI.
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/Comments/CommentNode.php2
-rw-r--r--apps/dav/tests/unit/Comments/CommentsNodeTest.php6
2 files changed, 6 insertions, 2 deletions
diff --git a/apps/dav/lib/Comments/CommentNode.php b/apps/dav/lib/Comments/CommentNode.php
index edf46d210fc..5c22f8a8a71 100644
--- a/apps/dav/lib/Comments/CommentNode.php
+++ b/apps/dav/lib/Comments/CommentNode.php
@@ -185,7 +185,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
$msg = 'Message exceeds allowed character limit of ';
throw new BadRequest($msg . IComment::MAX_MESSAGE_LENGTH, 0, $e);
}
- return false;
+ throw $e;
}
}
diff --git a/apps/dav/tests/unit/Comments/CommentsNodeTest.php b/apps/dav/tests/unit/Comments/CommentsNodeTest.php
index 6bf06375a43..18b18ab8d3b 100644
--- a/apps/dav/tests/unit/Comments/CommentsNodeTest.php
+++ b/apps/dav/tests/unit/Comments/CommentsNodeTest.php
@@ -166,6 +166,10 @@ class CommentsNodeTest extends \Test\TestCase {
$this->assertTrue($this->node->updateComment($msg));
}
+ /**
+ * @expectedException Exception
+ * @expectedExceptionMessage buh!
+ */
public function testUpdateCommentLogException() {
$msg = null;
@@ -198,7 +202,7 @@ class CommentsNodeTest extends \Test\TestCase {
$this->logger->expects($this->once())
->method('logException');
- $this->assertFalse($this->node->updateComment($msg));
+ $this->node->updateComment($msg);
}
/**