better error-handling when it's Ajax
This commit is contained in:
parent
963d052653
commit
9a62b7b18f
|
@ -75,6 +75,10 @@ class NewbookmarkAction extends Action
|
||||||
{
|
{
|
||||||
parent::prepare($argarray);
|
parent::prepare($argarray);
|
||||||
|
|
||||||
|
if ($this->boolean('ajax')) {
|
||||||
|
StatusNet::setApi(true);
|
||||||
|
}
|
||||||
|
|
||||||
$this->user = common_current_user();
|
$this->user = common_current_user();
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
@ -122,9 +126,6 @@ class NewbookmarkAction extends Action
|
||||||
*/
|
*/
|
||||||
function newBookmark()
|
function newBookmark()
|
||||||
{
|
{
|
||||||
if ($this->boolean('ajax')) {
|
|
||||||
StatusNet::setApi(true);
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (empty($this->title)) {
|
if (empty($this->title)) {
|
||||||
// TRANS: Client exception thrown when trying to create a new bookmark without a title.
|
// TRANS: Client exception thrown when trying to create a new bookmark without a title.
|
||||||
|
@ -148,9 +149,13 @@ class NewbookmarkAction extends Action
|
||||||
$options);
|
$options);
|
||||||
|
|
||||||
} catch (ClientException $ce) {
|
} catch (ClientException $ce) {
|
||||||
$this->error = $ce->getMessage();
|
if ($this->boolean('ajax')) {
|
||||||
$this->showPage();
|
throw $ce;
|
||||||
return;
|
} else {
|
||||||
|
$this->error = $ce->getMessage();
|
||||||
|
$this->showPage();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->boolean('ajax')) {
|
if ($this->boolean('ajax')) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user