mirror of
https://github.com/wiosna-dev/limesurvey-api-client.git
synced 2026-03-13 02:21:50 +01:00
ParticipantService - getSurveyParticipants() method - catch and serve an exception while fetching participants of given survey
This commit is contained in:
@@ -16,6 +16,13 @@ namespace Meritoo\LimeSurvey\ApiClient\Exception;
|
||||
*/
|
||||
class CannotProcessDataException extends \Exception
|
||||
{
|
||||
/**
|
||||
* Reason why data cannot be processed, e.g. "Invalid user name or password"
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $reason;
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
@@ -23,9 +30,21 @@ class CannotProcessDataException extends \Exception
|
||||
*/
|
||||
public function __construct($reason)
|
||||
{
|
||||
$this->reason = $reason;
|
||||
|
||||
$template = 'Raw data returned by the LimeSurvey\'s API cannot be processed. Reason: \'%s\'.';
|
||||
$message = sprintf($template, $reason);
|
||||
$message = sprintf($template, $this->reason);
|
||||
|
||||
parent::__construct($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns reason why data cannot be processed, e.g. "Invalid user name or password"
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getReason()
|
||||
{
|
||||
return $this->reason;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user