-
Notifications
You must be signed in to change notification settings - Fork 5
Optional evaluations and better errors. Closes broadinstitute/cromwell#1830 #67
Conversation
@@ -11,10 +11,10 @@ import scala.util.{Failure, Try} | |||
trait WdlValue { | |||
val wdlType: WdlType | |||
def invalid(operation: String) = Failure(new WdlExpressionException(s"Cannot perform operation: $operation")) | |||
def emptyValue(value: WdlOptionalValue) = Failure(VariableNotFoundException(value.toString)) | |||
def evaluateIfDefined[A <: WdlValue](optionalValue: WdlOptionalValue, operation: WdlValue => Try[A]): Try[A] = optionalValue match { | |||
def emptyValueFailure(operationName: String) = Failure(new UnsupportedOperationException(s"Sorry! Operation $operationName is not supported on empty optional values. You might resolve this using select_first(optional, default) to guarantee that you have a filled value.")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pinging @katevoss for critique!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filled? like a doughnut?
@@ -11,10 +11,10 @@ import scala.util.{Failure, Try} | |||
trait WdlValue { | |||
val wdlType: WdlType | |||
def invalid(operation: String) = Failure(new WdlExpressionException(s"Cannot perform operation: $operation")) | |||
def emptyValue(value: WdlOptionalValue) = Failure(VariableNotFoundException(value.toString)) | |||
def evaluateIfDefined[A <: WdlValue](optionalValue: WdlOptionalValue, operation: WdlValue => Try[A]): Try[A] = optionalValue match { | |||
def emptyValueFailure(operationName: String) = Failure(new UnsupportedOperationException(s"Sorry! Operation $operationName is not supported on empty optional values. You might resolve this using select_first(optional, default) to guarantee that you have a filled value.")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe should be select_first([optional, default])
@@ -11,10 +11,10 @@ import scala.util.{Failure, Try} | |||
trait WdlValue { | |||
val wdlType: WdlType | |||
def invalid(operation: String) = Failure(new WdlExpressionException(s"Cannot perform operation: $operation")) | |||
def emptyValue(value: WdlOptionalValue) = Failure(VariableNotFoundException(value.toString)) | |||
def evaluateIfDefined[A <: WdlValue](optionalValue: WdlOptionalValue, operation: WdlValue => Try[A]): Try[A] = optionalValue match { | |||
def emptyValueFailure(operationName: String) = Failure(new UnsupportedOperationException(s"Sorry! Operation $operationName is not supported on empty optional values. You might resolve this using select_first(optional, default) to guarantee that you have a filled value.")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filled? like a doughnut?
@katevoss that |
Will return later! |
No description provided.