Skip to content

Commit

Permalink
fix: improve error reports
Browse files Browse the repository at this point in the history
  • Loading branch information
tikhanovichA committed Feb 25, 2025
1 parent e192069 commit 2cd8187
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions model/Export/AbstractQTIItemExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ public function export($options = [])
$replacementList[$assetUrl] = '';
$report->setMessage($e->getMessage());
$report->setType(Report::TYPE_ERROR);
} catch (FilesystemException $exception) {
$replacementList[$assetUrl] = '';
$report->setMessage($exception->getMessage());
$report->setType(Report::TYPE_ERROR);
return $report;
}
}

Expand Down
8 changes: 4 additions & 4 deletions model/Export/QTIPackedItemExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
use oat\taoQtiItem\model\qti\Service;
use core_kernel_classes_Resource;
use oat\taoQtiTest\models\classes\metadata\GenericLomOntologyExtractor;
use oat\taoQtiTest\models\classes\metadata\MetadataLomService;
use ZipArchive;
use DOMDocument;
use oat\oatbox\reporting\Report;
use tao_helpers_Uri;
use taoItems_models_classes_TemplateRenderer;
use tao_helpers_Display;
Expand Down Expand Up @@ -72,7 +72,7 @@ public function export($options = [])
{
if (!$this->containsItem()) {
$report = parent::export($options);
if ($report->getType() === \common_report_Report::TYPE_ERROR || $report->containsError()) {
if ($report->getType() === Report::TYPE_ERROR || $report->containsError()) {
return $report;
}
try {
Expand All @@ -82,12 +82,12 @@ public function export($options = [])
}
$this->exportManifest($options, $exportResult);
} catch (ExportException $e) {
$report->setType(\common_report_Report::TYPE_ERROR);
$report->setType(Report::TYPE_ERROR);
$report->setMessage($e->getUserMessage());
}
return $report;
}
return \common_report_Report::createSuccess();
return Report::createSuccess();
}

/**
Expand Down

0 comments on commit 2cd8187

Please sign in to comment.