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

Commit

Permalink
BUG: refs #0282. Fixed passing through error messages for add and edi…
Browse files Browse the repository at this point in the history
…t actions.
  • Loading branch information
Michael Grauer committed Dec 21, 2011
1 parent e9f9d17 commit bae16c2
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions core/controllers/AssetstoreController.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,15 @@ function editAction()
{
$assetstore->setName($assetstoreName);
$assetstore->setPath($assetstorePath);
$this->Assetstore->save($assetstore);
try
{
$this->Assetstore->save($assetstore);
}
catch(Zend_Exception $ze)
{
echo JsonComponent::encode(array(false, $ze->getMessage()));
return;
}
echo JsonComponent::encode(array(true, $this->t('Changes saved')));
return;
}
Expand Down Expand Up @@ -160,8 +168,16 @@ function addAction()
$assetstoreDao->setName($form->name->getValue());
$assetstoreDao->setPath($form->basedirectory->getValue());
$assetstoreDao->setType($form->assetstoretype->getValue());
$this->Assetstore->save($assetstoreDao);

try
{
$this->Assetstore->save($assetstoreDao);
}
catch(Zend_Exception $ze)
{
echo json_encode(array('error' => $ze->getMessage()));
return false;
}

echo json_encode(array('msg' => 'The assetstore has been added.',
'assetstore_id' => $assetstoreDao->getAssetstoreId(),
'assetstore_name' => $assetstoreDao->getName(),
Expand Down

0 comments on commit bae16c2

Please sign in to comment.