Skip to content

Commit

Permalink
[#911 state:resolved] Improved the error message that occurs when vie…
Browse files Browse the repository at this point in the history
…wing an object that does not exist.
  • Loading branch information
byrnereese committed May 16, 2011
1 parent 8017f04 commit 14c7015
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions lib/MT/CMS/Common.pm
Original file line number Diff line number Diff line change
Expand Up @@ -455,16 +455,20 @@ sub edit {
}

if ($id) { # object exists, we're just editing it.
# Stash the object itself so we don't have to keep forcing the promise
$obj = $obj_promise->force()
or return
$app->error(
$app->translate(
"Load failed: [_1]",
$class->errstr || $app->translate("(no reason given)")
)
);

# Stash the object itself so we don't have to keep forcing the promise
$obj = $obj_promise->force();
unless ($obj) {
my $error;
if ($class->errstr) {
$error = $app->translate("Load failed: [_1]",$class->errstr);
} elsif ( !MT->model($type)->exist( $id ) ) {
$error = $app->translate("[_1] does not exist.",MT->model($type)->class_label);
} else {
$error = $app->translate( "(no reason given)");
}
return $app->error( $error );
}

# Populate the param hash with the object's own values
for my $col (@$cols) {
$param{$col}
Expand Down

0 comments on commit 14c7015

Please sign in to comment.