Skip to content

Add line numbers to a few errors that we ask users to report #3188

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions stan/math/prim/meta/forward_as.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ template <typename T_desired, typename T_actual,
!std::is_same<std::decay<T_actual>, std::decay<T_desired>>::value
&& (!is_eigen<T_desired>::value || !is_eigen<T_actual>::value)>>
inline T_desired forward_as(const T_actual& a) {
throw std::runtime_error("Wrong type assumed! Please file a bug report.");
throw std::runtime_error(
"Wrong type assumed! Please file a bug report. prim/meta/forward_as.hpp "
"line "
+ std::to_string(__LINE__));
}

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

} // namespace math
Expand Down
6 changes: 4 additions & 2 deletions stan/math/rev/fun/adjoint_of.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ struct nonexisting_adjoint {
nonexisting_adjoint operator+=(T) const {
throw std::runtime_error(
"internal::nonexisting_adjoint::operator+= should never be called! "
"Please file a bug report.");
"Please file a bug report. rev/fun/adjoint_of.hpp line "
+ std::to_string(__LINE__));
}
template <typename T>
nonexisting_adjoint operator-=(T) const {
throw std::runtime_error(
"internal::nonexisting_adjoint::operator-= should never be called! "
"Please file a bug report.");
"Please file a bug report. rev/fun/adjoint_of.hpp line "
+ std::to_string(__LINE__));
}
};
} // namespace internal
Expand Down