[Jifty-commit] r524 - in jifty/trunk: lib/Jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Jan 23 17:28:09 EST 2006
Author: alexmv
Date: Mon Jan 23 17:28:09 2006
New Revision: 524
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Dispatcher.pm
Log:
r8773 at zoq-fot-pik: chmrr | 2006-01-23 17:27:31 -0500
* More gracefully handle mason errors
Modified: jifty/trunk/lib/Jifty/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Dispatcher.pm (original)
+++ jifty/trunk/lib/Jifty/Dispatcher.pm Mon Jan 23 17:28:09 2006
@@ -612,19 +612,28 @@
sub _do_show {
my $self = shift;
my $path;
+
+ # Fix up the path
$path = shift if (@_);
$path ||= $self->{cgi}->path_info;
$path = "$self->{cwd}/$path" unless $path =~ m{^/};
$path .= "index.html" if $path =~ m{/$};
+ # Redirect to directory (and then index) if they requested the directory itself
$self->_do_redirect($path . "/")
if -d Jifty::Util->absolute_path( (Jifty->config->framework('Web')->{'TemplateRoot'} || "html") . $path );
+ # Set the request path
$self->{cgi}->path_info($path);
- eval {
- $self->{handler}->handle_cgi_object($self->{cgi});
+
+ # Handle the request with Mason
+ eval { $self->{handler}->handle_cgi_object($self->{cgi}); };
+
+ # Handle parse errors
+ if ( $@ and not UNIVERSAL::isa $@, 'HTML::Mason::Exception::Abort' ) {
+ warn "Mason error: $@";
+ Jifty->web->redirect("/__jifty/error/mason_parse_error");
};
- die $@ if ( $@ and not UNIVERSAL::isa $@, 'HTML::Mason::Exception::Abort' ) ;
last_rule;
}
More information about the Jifty-commit
mailing list