Skip to content

Commit 5f85d74

Browse files
authored
Merge pull request #3188 from stan-dev/more-info-unexpected-error
Add line numbers to a few errors that we ask users to report
2 parents 09542d0 + a804493 commit 5f85d74

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

stan/math/prim/meta/forward_as.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ template <
6262
&& !(std::is_floating_point_v<std::decay_t<
6363
T_desired>> && std::is_integral_v<std::decay_t<T_actual>>)>>
6464
inline T_desired forward_as(const T_actual& a) {
65-
throw std::runtime_error("Wrong type assumed! Please file a bug report.");
65+
throw std::runtime_error(
66+
"Wrong type assumed! Please file a bug report. prim/meta/forward_as.hpp "
67+
"line "
68+
+ std::to_string(__LINE__));
6669
}
6770

6871
/** \ingroup type_trait
@@ -146,7 +149,10 @@ template <
146149
T_desired::ColsAtCompileTime,
147150
std::decay_t<T_actual>::ColsAtCompileTime)>* = nullptr>
148151
inline T_desired forward_as(const T_actual& a) {
149-
throw std::runtime_error("Wrong type assumed! Please file a bug report.");
152+
throw std::runtime_error(
153+
"Wrong type assumed! Please file a bug report. prim/meta/forward_as.hpp "
154+
"line "
155+
+ std::to_string(__LINE__));
150156
}
151157

152158
} // namespace math

stan/math/rev/fun/adjoint_of.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ struct nonexisting_adjoint {
1616
nonexisting_adjoint operator+=(T) const {
1717
throw std::runtime_error(
1818
"internal::nonexisting_adjoint::operator+= should never be called! "
19-
"Please file a bug report.");
19+
"Please file a bug report. rev/fun/adjoint_of.hpp line "
20+
+ std::to_string(__LINE__));
2021
}
2122
template <typename T>
2223
nonexisting_adjoint operator-=(T) const {
2324
throw std::runtime_error(
2425
"internal::nonexisting_adjoint::operator-= should never be called! "
25-
"Please file a bug report.");
26+
"Please file a bug report. rev/fun/adjoint_of.hpp line "
27+
+ std::to_string(__LINE__));
2628
}
2729
};
2830
} // namespace internal

0 commit comments

Comments
 (0)