flyaflya / causact

causact: R package to accelerate computational Bayesian inference workflows in R through interactive visualization of models and their output.
http://causact.com
Other
43 stars 12 forks source link

Add helpful user error messages. #3

Closed flyaflya closed 4 years ago

flyaflya commented 5 years ago

Currently, the causact package has zero error messaging. It would be nice to have some defensive programming built into the system.

See here: http://adv-r.had.co.nz/Exceptions-Debugging.html

flyaflya commented 5 years ago

following code should give more useful error message (pB is undefined):

dag_create() %>% dag_node("Demand for A","dA", rhs = normal(15,4)) %>% dag_node("Demand for B","dB", rhs = normal(20,8)) %>% dag_node("Supply for A","sA", rhs = uniform(0,100)) %>% dag_node("Supply for B","sB", rhs = uniform(0,100)) %>% dag_node("Profit for A","pA", rhs = min(sA,dA)) %>% dag_edge(from = c("dA","sA"),to = c("pA")) %>% dag_edge(from = c("dB","sB"),to = c("pB")) %>% dag_render()