Turned error into actual error
This commit is contained in:
parent
1102ceb4ec
commit
51e2cf167c
|
@ -88,10 +88,13 @@ describe("eval on distribution functions", () => {
|
|||
|
||||
describe("log", () => {
|
||||
testEval("log(2, uniform(5,8))", "Ok(Sample Set Distribution)")
|
||||
testEval("log(normal(5,2), 3)", "Error(Distribution Math Error: Argument Error First input of logarithm must be fully greater than 0)")
|
||||
testEval(
|
||||
"log(normal(5,2), 3)",
|
||||
"Error(Distribution Math Error: Logarithm of input error: First input must completely greater than 0)",
|
||||
)
|
||||
testEval(
|
||||
"log(normal(5,2), normal(10,1))",
|
||||
"Error(Distribution Math Error: Argument Error First input of logarithm must be fully greater than 0)",
|
||||
"Error(Distribution Math Error: Logarithm of input error: First input must completely greater than 0)",
|
||||
)
|
||||
testEval("log(uniform(5,8))", "Ok(Sample Set Distribution)")
|
||||
testEval("log10(uniform(5,8))", "Ok(Sample Set Distribution)")
|
||||
|
|
|
@ -14,6 +14,7 @@ type error =
|
|||
| OperationError(Operation.Error.t)
|
||||
| PointSetConversionError(SampleSetDist.pointsetConversionError)
|
||||
| SparklineError(PointSetTypes.sparklineError) // This type of error is for when we find a sparkline of a discrete distribution. This should probably at some point be actually implemented
|
||||
| LogarithmOfDistributionError(string)
|
||||
| OtherError(string)
|
||||
|
||||
@genType
|
||||
|
@ -29,6 +30,7 @@ module Error = {
|
|||
| Unreachable => "Unreachable"
|
||||
| DistributionVerticalShiftIsInvalid => "Distribution Vertical Shift is Invalid"
|
||||
| ArgumentError(s) => `Argument Error ${s}`
|
||||
| LogarithmOfDistributionError(s) => `Logarithm of input error: ${s}`
|
||||
| TooFewSamples => "Too Few Samples"
|
||||
| OperationError(err) => Operation.Error.toString(err)
|
||||
| PointSetConversionError(err) => SampleSetDist.pointsetConversionErrorToString(err)
|
||||
|
|
|
@ -207,9 +207,10 @@ module AlgebraicCombination = {
|
|||
])
|
||||
switch items {
|
||||
| Error(r) => Some(r)
|
||||
| Ok([true, _]) => Some(ArgumentError("First input of logarithm must be fully greater than 0"))
|
||||
| Ok([true, _]) =>
|
||||
Some(LogarithmOfDistributionError("First input must completely greater than 0"))
|
||||
| Ok([false, true]) =>
|
||||
Some(ArgumentError("Second input of logarithm must be fully greater than 0"))
|
||||
Some(LogarithmOfDistributionError("Second input must completely greater than 0"))
|
||||
| Ok([false, false]) => None
|
||||
| Ok(_) => Some(Unreachable)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user