Skip to content

Commit

Permalink
provide more exhaustive message in validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Szymon Olewniczak committed Feb 5, 2019
1 parent d7f653d commit 0327ffe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugin.info.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
base structgroup
author Szymon Olewniczak
email it@rid.pl
date 2018-09-08
date 2019-02-05
name Struct Group
desc New struct type - dokuwiki user groups
url https://dokuwiki.org/plugin:structgroup
5 changes: 3 additions & 2 deletions types/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Group extends AbstractMultiBaseType {

/**
* @param string $rawvalue the user to validate
* @return int|string|void
* @return int|string
*/
public function validate($rawvalue) {
$rawvalue = parent::validate($rawvalue);
Expand All @@ -29,7 +29,8 @@ public function validate($rawvalue) {
$authgroup = plugin_load('helper', 'structgroup_authgroup');

if(! in_array($rawvalue, $authgroup->getGroups())) {
throw new ValidationException('Group not found', $rawvalue);
throw new ValidationException('Group not found: "' . $rawvalue .
'". Available groups: ' . implode(', ', $authgroup->getGroups()));
}
}

Expand Down

0 comments on commit 0327ffe

Please sign in to comment.