-
-
Notifications
You must be signed in to change notification settings - Fork 381
Closed
Description
Description:
When exceptions are thrown in the logic of if/then statements the line number points to the first if statement and not the actual line where the exception was encountered.
Reproducible Steps:
parameters {
real x;
}
model {
x ~ normal(0, 1);
}
generated quantities {
real y;
if (x < 0) {
y = x;
} else if (bernoulli_rng(1.1)) {
y = -x;
}
}
The behavior is the same without the braces, too,
parameters {
real x;
}
model {
x ~ normal(0, 1);
}
generated quantities {
real y;
if (x < 0)
y = x;
else if (bernoulli_rng(1.1))
y = -x;
}
Current Output:
Exception: Exception thrown at line 12: stan::math::bernoulli_rng: Probability parameter is 1.1, but must be between (0, 1)
Diagnostic information:
Dynamic exception type: std::domain_error
std::exception::what: Exception thrown at line 12: stan::math::bernoulli_rng: Probability parameter is 1.1, but must be between (0, 1)
Expected Output:
The exception is thrown at line 14. Line 12 is where the if statement begins.
Additional Information:
Exceptions thrown within the body of the if/then statements report accurate line numbers. It just seems to be when the exceptions are thrown in the checks themselves.
Current Version:
Develop.