mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-69143 contentbank: catching Exception on file upload
This commit is contained in:
parent
910755acf5
commit
5132309170
@ -28,7 +28,7 @@ use core\event\contentbank_content_created;
|
||||
use core\event\contentbank_content_deleted;
|
||||
use core\event\contentbank_content_viewed;
|
||||
use stored_file;
|
||||
use file_exception;
|
||||
use Exception;
|
||||
use moodle_url;
|
||||
|
||||
/**
|
||||
@ -107,7 +107,7 @@ abstract class contenttype {
|
||||
$content = $this->create_content($record);
|
||||
try {
|
||||
$content->import_file($file);
|
||||
} catch (file_exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->delete_content($content);
|
||||
throw $e;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace core_contentbank;
|
||||
use stdClass;
|
||||
use context_system;
|
||||
use context_user;
|
||||
use file_exception;
|
||||
use Exception;
|
||||
use contenttype_testable\contenttype as contenttype;
|
||||
/**
|
||||
* Test for content bank contenttype class.
|
||||
@ -283,7 +283,7 @@ class core_contenttype_contenttype_testcase extends \advanced_testcase {
|
||||
try {
|
||||
$content = $contenttype->upload_content($dummyfile);
|
||||
$this->assertTrue(false);
|
||||
} catch (file_exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
$this->assertEquals($cbcontents, $DB->count_records('contentbank_content'));
|
||||
|
Loading…
x
Reference in New Issue
Block a user