[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 7376c94 2/2: Prefer logic_error to runtime_er
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 7376c94 2/2: Prefer logic_error to runtime_error for precondition violations |
Date: |
Fri, 7 Sep 2018 11:32:39 -0400 (EDT) |
branch: master
commit 7376c94de3c5dfe15fec07b733aa5363568354f4
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Prefer logic_error to runtime_error for precondition violations
---
report_table.cpp | 2 +-
report_table_test.cpp | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/report_table.cpp b/report_table.cpp
index 1eaf9c4..59e5287 100644
--- a/report_table.cpp
+++ b/report_table.cpp
@@ -179,7 +179,7 @@ std::vector<int> set_column_widths
namespace
{
// An assertion to this effect is emulated in the ctor-initializer.
-std::runtime_error yikes("Rows per group must be positive.");
+std::logic_error yikes("Rows per group must be positive.");
} // Unnamed namespace.
/// Preconditions: 0 <= total_rows && 0 < rows_per_group <= max_lines_per_page
diff --git a/report_table_test.cpp b/report_table_test.cpp
index d07ce70..ac8394a 100644
--- a/report_table_test.cpp
+++ b/report_table_test.cpp
@@ -435,14 +435,14 @@ void report_table_test::test_paginator()
// Zero rows per group.
BOOST_TEST_THROW
(paginator(1, 0, 1)
- ,std::runtime_error
+ ,std::logic_error
,"Rows per group must be positive."
);
// Negative number of rows per group.
BOOST_TEST_THROW
(paginator(1, -1, 1)
- ,std::runtime_error
+ ,std::logic_error
,"Rows per group must be positive."
);