mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Fixes vague error when attribute is not fillable
Previously an error was being thrown with just the attribute name, not helpful at all. Fixes #2302
This commit is contained in:
parent
6070d2f6bd
commit
d7b9b4f65e
@ -8,6 +8,7 @@ use Backend;
|
||||
use BackendAuth;
|
||||
use Backend\Classes\ControllerBehavior;
|
||||
use Backend\Behaviors\ImportExportController\TranscodeFilter;
|
||||
use Illuminate\Database\Eloquent\MassAssignmentException;
|
||||
use League\Csv\Reader as CsvReader;
|
||||
use League\Csv\Writer as CsvWriter;
|
||||
use ApplicationException;
|
||||
@ -189,6 +190,12 @@ class ImportExportController extends ControllerBehavior
|
||||
$this->vars['importResults'] = $model->getResultStats();
|
||||
$this->vars['returnUrl'] = $this->getRedirectUrlForType('import');
|
||||
}
|
||||
catch (MassAssignmentException $ex) {
|
||||
$this->controller->handleError(new ApplicationException(Lang::get(
|
||||
'backend::lang.model.mass_assignment_failed',
|
||||
['attribute' => $ex->getMessage()]
|
||||
)));
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
$this->controller->handleError($ex);
|
||||
}
|
||||
@ -411,6 +418,12 @@ class ImportExportController extends ControllerBehavior
|
||||
$this->vars['fileUrl'] = $fileUrl;
|
||||
$this->vars['returnUrl'] = $this->getRedirectUrlForType('export');
|
||||
}
|
||||
catch (MassAssignmentException $ex) {
|
||||
$this->controller->handleError(new ApplicationException(Lang::get(
|
||||
'backend::lang.model.mass_assignment_failed',
|
||||
['attribute' => $ex->getMessage()]
|
||||
)));
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
$this->controller->handleError($ex);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user