Skip to content

Commit a804493

Browse files
committed
Add line numbers to a few errors that we ask users to report if they arise
1 parent 9f23455 commit a804493

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
@@ -59,7 +59,10 @@ template <typename T_desired, typename T_actual,
5959
!std::is_same<std::decay<T_actual>, std::decay<T_desired>>::value
6060
&& (!is_eigen<T_desired>::value || !is_eigen<T_actual>::value)>>
6161
inline T_desired forward_as(const T_actual& a) {
62-
throw std::runtime_error("Wrong type assumed! Please file a bug report.");
62+
throw std::runtime_error(
63+
"Wrong type assumed! Please file a bug report. prim/meta/forward_as.hpp "
64+
"line "
65+
+ std::to_string(__LINE__));
6366
}
6467

6568
/** \ingroup type_trait
@@ -120,7 +123,10 @@ template <
120123
T_desired::ColsAtCompileTime,
121124
std::decay_t<T_actual>::ColsAtCompileTime)>* = nullptr>
122125
inline T_desired forward_as(const T_actual& a) {
123-
throw std::runtime_error("Wrong type assumed! Please file a bug report.");
126+
throw std::runtime_error(
127+
"Wrong type assumed! Please file a bug report. prim/meta/forward_as.hpp "
128+
"line "
129+
+ std::to_string(__LINE__));
124130
}
125131

126132
} // 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)