tweak: Add better error messages for common use case
I.e., the case of integrating a function which doesn't return a number but a distribution
This commit is contained in:
parent
2b414191ac
commit
c0713b16c2
|
@ -161,7 +161,10 @@ module Internals = {
|
||||||
}
|
}
|
||||||
resultWithOuterPoints
|
resultWithOuterPoints
|
||||||
}
|
}
|
||||||
| false => Error("Integration error 3 in Danger.integrate")
|
| false =>
|
||||||
|
Error(
|
||||||
|
"Integration error 3 in Danger.integrate. It's possible that your function doesn't return a number, try definining auxiliaryFunction(x) = mean(yourFunction(x)) and integrate auxiliaryFunction instead",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
@ -286,12 +289,10 @@ let library = [
|
||||||
numIntegrationPoints,
|
numIntegrationPoints,
|
||||||
env,
|
env,
|
||||||
reducer,
|
reducer,
|
||||||
)->E.R2.errMap(_ =>
|
|
||||||
"Integration error 5 in Danger.integrate. Something went wrong along the way"
|
|
||||||
)
|
)
|
||||||
| _ =>
|
| _ =>
|
||||||
Error(
|
Error(
|
||||||
"Integration error 6 in Danger.integrate. Remember that inputs are (function, number (min), number (max), number(increment))",
|
"Integration error 5 in Danger.integrate. Remember that inputs are (function, number (min), number (max), number(increment))",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
|
|
Loading…
Reference in New Issue
Block a user