Skip to content

Commit

Permalink
Merge remote-tracking branch 'byrnereese/lh-911-improve-errmsg' into …
Browse files Browse the repository at this point in the history
…melody-1.0.1

* byrnereese/lh-911-improve-errmsg:
  [#911 state:resolved] Improved the error message that occurs when viewing an object that does not exist.
  • Loading branch information
jayallen committed May 16, 2011
2 parents d70691b + 14c7015 commit 6cb1fe4
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 6cb1fe4

Please sign in to comment.