Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit bae16c2

Browse files
author
Michael Grauer
committed
BUG: refs #0282. Fixed passing through error messages for add and edit actions.
1 parent e9f9d17 commit bae16c2

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

core/controllers/AssetstoreController.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,15 @@ function editAction()
129129
{
130130
$assetstore->setName($assetstoreName);
131131
$assetstore->setPath($assetstorePath);
132-
$this->Assetstore->save($assetstore);
132+
try
133+
{
134+
$this->Assetstore->save($assetstore);
135+
}
136+
catch(Zend_Exception $ze)
137+
{
138+
echo JsonComponent::encode(array(false, $ze->getMessage()));
139+
return;
140+
}
133141
echo JsonComponent::encode(array(true, $this->t('Changes saved')));
134142
return;
135143
}
@@ -160,8 +168,16 @@ function addAction()
160168
$assetstoreDao->setName($form->name->getValue());
161169
$assetstoreDao->setPath($form->basedirectory->getValue());
162170
$assetstoreDao->setType($form->assetstoretype->getValue());
163-
$this->Assetstore->save($assetstoreDao);
164-
171+
try
172+
{
173+
$this->Assetstore->save($assetstoreDao);
174+
}
175+
catch(Zend_Exception $ze)
176+
{
177+
echo json_encode(array('error' => $ze->getMessage()));
178+
return false;
179+
}
180+
165181
echo json_encode(array('msg' => 'The assetstore has been added.',
166182
'assetstore_id' => $assetstoreDao->getAssetstoreId(),
167183
'assetstore_name' => $assetstoreDao->getName(),

0 commit comments

Comments
 (0)