Commit ec24160b authored by jaapjansma's avatar jaapjansma
Browse files

Added exception handling

parent 1f9393e3
......@@ -32,20 +32,24 @@ function dataprocessor_token_output_evaluate_tokens($event) {
$dao = _dataprocessor_token_output_get_dao();
while($dao->fetch()) {
$outputClass = $factory->getOutputByName($dao->type);
if (!$outputClass instanceof Civi\DataprocessorTokenOutput\Output\TokenOutput) {
continue;
}
if (!$outputClass->availableForEvaluateToken($event)) {
continue;
}
// Find data processors for this output.
$dataprocessor = civicrm_api3('DataProcessor', 'getsingle', ['id' => $dao->data_processor_id]);
$configuration = json_decode($dao->configuration, true);
$dataProcessorClass = CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($dataprocessor);
try {
$outputClass = $factory->getOutputByName($dao->type);
if (!$outputClass instanceof Civi\DataprocessorTokenOutput\Output\TokenOutput) {
continue;
}
if (!$outputClass->availableForEvaluateToken($event)) {
continue;
}
// Find data processors for this output.
$dataprocessor = civicrm_api3('DataProcessor', 'getsingle', ['id' => $dao->data_processor_id]);
$configuration = json_decode($dao->configuration, TRUE);
$dataProcessorClass = CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($dataprocessor);
$outputClass->evaluateTokens($event, $dataProcessorClass, $dataprocessor['name'], $configuration);
$outputClass->evaluateTokens($event, $dataProcessorClass, $dataprocessor['name'], $configuration);
} catch (\Exception $e) {
// Do nothing.
}
}
}
......@@ -66,15 +70,19 @@ function dataprocessor_token_output_civicrm_tokens(&$tokens) {
$dao = _dataprocessor_token_output_get_dao();
while($dao->fetch()) {
$outputClass = $factory->getOutputByName($dao->type);
if (!$outputClass instanceof Civi\DataprocessorTokenOutput\Output\TokenOutput) {
continue;
}
$dataprocessor = civicrm_api3('DataProcessor', 'getsingle', ['id' => $dao->data_processor_id]);
$configuration = json_decode($dao->configuration, true);
$dataProcessorClass = CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($dataprocessor);
try {
$outputClass = $factory->getOutputByName($dao->type);
if (!$outputClass instanceof Civi\DataprocessorTokenOutput\Output\TokenOutput) {
continue;
}
$dataprocessor = civicrm_api3('DataProcessor', 'getsingle', ['id' => $dao->data_processor_id]);
$configuration = json_decode($dao->configuration, TRUE);
$dataProcessorClass = CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($dataprocessor);
$outputClass->tokens($tokens, $dataProcessorClass, $dataprocessor['title'], $dataprocessor['name'], $configuration);
$outputClass->tokens($tokens, $dataProcessorClass, $dataprocessor['title'], $dataprocessor['name'], $configuration);
} catch (\Exception $e) {
// Do nothing.
}
}
}
......
......@@ -13,8 +13,8 @@
<url desc="Documentation">https://lab.civicrm.org/extensions/dataprocessor-token-output/blob/master/README.md</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2022-08-03</releaseDate>
<version>1.10</version>
<releaseDate>2022-09-19</releaseDate>
<version>1.11</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.13</ver>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment