-
Notifications
You must be signed in to change notification settings - Fork 6
Improve error reporting in coerce for unsupported coercions #39
Comments
There's something funny going on here. The error message implies the method So let's revisit this after Julia 1.5.1 is released. |
The behavior is same with julia 1.5.1 release julia> X = (x=1:3,)
(x = 1:3,)
julia> coerce(X, :x=>Textual)
ERROR: MLJScientificTypes.CoercionError("`coerce` is undefined for non-tabular data.")
julia> InteractiveUtils.versioninfo()
Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, broadwell) EDIT |
@ablaom. This issue is because there is currently no defined way of coercing function coerce(v, ::Type{T};
verbosity::Int=1, tight::Bool=false
)where T2 <: Union{Missing,Finite}
throw(ArgumentError("Can't coerce $v which is of scitype $(scitype(v)) to scitype $."*
"Or a better descriptive error message"))
return
end |
What if we add coerce(X::AbstractArray, a; kw...) =
throw(CoercionError("Coercion to $a not supported for arrays of eltype $(eltype(X)). ")) ? This is ought to cover more cases, no? |
no. The first case is more general and should cover all cases. |
On second thought the example you gave is actually more general since |
The text was updated successfully, but these errors were encountered: