diff --git a/src/Exceptions/ForbiddenException.php b/src/Exceptions/ForbiddenException.php index 5699066..a6c077d 100644 --- a/src/Exceptions/ForbiddenException.php +++ b/src/Exceptions/ForbiddenException.php @@ -14,8 +14,9 @@ public static function forOnlyAjax() return new self( lang( 'Rest.textRestAjaxOnly' ) ); } - public static function validationtMethodParamsError() + public static function validationtMethodParamsError( $param ) { - return new self( lang( 'Rest.textInvalidMethodParams' ) ); + $parser = \Config\Services::parser(); + return new self( $parser->setData( array( 'param' => $param ) )->renderString( lang( 'Rest.textInvalidMethodParams' ) ) ); } } diff --git a/src/Language/en/Rest.php b/src/Language/en/Rest.php index 493dbe2..2045b2f 100644 --- a/src/Language/en/Rest.php +++ b/src/Language/en/Rest.php @@ -15,7 +15,7 @@ 'textRestApiKeyUnauthorized' => 'This API key does not have access to the requested controller', 'textInvalidUserClassConfiguration' => 'Invalid user class configuration, extends( \Daycry\RestServer\Libraries\User\UserAbstract )', 'textRestAjaxOnly' => 'Only AJAX requests are allowed', - 'textInvalidMethodParams' => 'Invalid params for this method' + 'textInvalidMethodParams' => 'Invalid params for this method: {param}' ]; /* diff --git a/src/RestServer.php b/src/RestServer.php index 98bcaec..1169061 100644 --- a/src/RestServer.php +++ b/src/RestServer.php @@ -875,7 +875,7 @@ protected function validation( String $rules, \Config\Validation $config = null, { if( !array_key_exists( $key, $config->{$rules} ) ) { - throw ForbiddenException::validationtMethodParamsError(); + throw ForbiddenException::validationtMethodParamsError( $key ); } } }