Unverified Commit d2b04eda authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

work: export-user-data: error handling

parent 28db8ddf
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -898,7 +898,12 @@ sub run {
			my $name     = $user_data->{account}{name};
			my $filename = "travelynx-export-${name}-${now_yyyymmdd}.json";

			eval {
				write_file( "public/tmp/$filename", $json->encode($user_data) );
			};
			if ($@) {
				$self->app->log->error("export-user-data($uid): $@");
			}

			$self->app->users->set_export(
				uid      => $uid,
@@ -913,7 +918,8 @@ sub run {
				my $yyyymmdd = $1;
				if ( $now_yyyymmdd - $yyyymmdd >= 2 ) {
					unlink("public/tmp/${filename}")
					  or warn("could not unlink public/tmp/${filename}: $!");
					  or $self->app->log->error(
						"could not unlink public/tmp/${filename}: $!");
					$self->app->users->set_export(
						uid      => $uid,
						status   => 0,