Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log failed app find #825

Merged
merged 2 commits into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.codeforamerica.shiba.pages.Sentiment;
import org.codeforamerica.shiba.pages.data.ApplicationData;
import org.jetbrains.annotations.NotNull;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
Expand Down Expand Up @@ -99,10 +100,17 @@ public Application find(String id) {
Application application = jdbcTemplate.queryForObject(
"SELECT * FROM applications WHERE id = ?",
applicationRowMapper(), id);
Objects.requireNonNull(application).setApplicationStatuses(
jdbcTemplate.query("SELECT * FROM application_status WHERE application_id = ?",
new ApplicationStatusRowMapper(), id));
return application;
try {
Objects.requireNonNull(application).setApplicationStatuses(
jdbcTemplate.query("SELECT * FROM application_status WHERE application_id = ?",
new ApplicationStatusRowMapper(), id));
return application;
} catch(EmptyResultDataAccessException e) {
log.error("Application find failed, id: " + id);
throw new EmptyResultDataAccessException(e.getMessage() + ", searching for application Id:" + id,
e.getExpectedSize(),
e);
}
}

public List<Application> findApplicationsStuckSending() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ ModelAndView submitApplication(
applicationData.setSubmitted(true);
return new ModelAndView(String.format("redirect:/pages/%s/navigation", submitPage));
} else {
log.error("Invalid page data at submit, application Id: " + applicationData.getId());
return new ModelAndView("redirect:/pages/" + submitPage);
}
}
Expand Down