Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

handle bad input to database installation (closes #14)

  • Loading branch information...
commit c5db1b85be2869a12403fe067beff211ea6e3a07 1 parent 5e0cd78
@jberger authored
Showing with 10 additions and 4 deletions.
  1. +8 −2 lib/Galileo/Command/setup.pm
  2. +2 −2 lib/Galileo/DB/Deploy.pm
View
10 lib/Galileo/Command/setup.pm
@@ -113,8 +113,14 @@ sub run {
my $user = $self->param('user');
my $full = $self->param('full');
- $dh->do_install;
- $dh->inject_sample_data($user, $pw1, $full);
+ eval { $dh->do_install };
+ eval { $dh->inject_sample_data($user, $pw1, $full) };
+ if ($@) {
+ my $error = "$@";
+ chomp $error;
+ $self->humane_flash( $error );
+ return $self->redirect_to('database');
+ }
$self->flash( 'galileo.message' => 'Database has been setup' );
$self->redirect_to('finish');
View
4 lib/Galileo/DB/Deploy.pm
@@ -104,8 +104,8 @@ sub inject_sample_data {
my $self = shift;
my $schema = $self->schema;
- my $user = shift or die "Must provide an administrative username";
- my $pass = shift or die "Must provide a password for $user";
+ my $user = shift or die "Must provide an admin username\n";
+ my $pass = shift or die "Must provide a password for admin user\n";
my $full = shift || "Administrator";
my $admin = $schema->resultset('User')->create({
Please sign in to comment.
Something went wrong with that request. Please try again.