Errors

This package tries to minimise the use of generic errors, and maximise the helpfulness of error messages. To that end, a number of new error types are defined.

Identifier exceptions

DataToolkitBase.UnresolveableIdentifierType
UnresolveableIdentifier{T}(identifier::Union{String, UUID}, [collection::DataCollection])

No T (optionally from collection) could be found that matches identifier.

Example occurrences

julia> d"iirs"
ERROR: UnresolveableIdentifier: "iirs" does not match any available data sets
  Did you perhaps mean to refer to one of these data sets?
    ■:iris (75% match)
Stacktrace: [...]

julia> d"iris::Int"
ERROR: UnresolveableIdentifier: "iris::Int" does not match any available data sets
  Without the type restriction, however, the following data sets match:
    dataset:iris, which is available as a DataFrame, Matrix, CSV.File
Stacktrace: [...]
source
DataToolkitBase.AmbiguousIdentifierType
AmbiguousIdentifier(identifier::Union{String, UUID}, matches::Vector, [collection])

Searching for identifier (optionally within collection), found multiple matches (provided as matches).

Example occurrence

julia> d"multimatch"
ERROR: AmbiguousIdentifier: "multimatch" matches multiple data sets
    ■:multimatch [45685f5f-e6ff-4418-aaf6-084b847236a8]
    ■:multimatch [92be4bda-55e9-4317-aff4-8d52ee6a5f2c]
Stacktrace: [...]
source

Package exceptions

DataToolkitBase.UnregisteredPackageType
UnregisteredPackage(pkg::Symbol, mod::Module)

The package pkg was asked for within mod, but has not been registered by mod, and so cannot be loaded.

Example occurrence

julia> @import Foo
ERROR: UnregisteredPackage: Foo has not been registered by Main, see @addpkg for more information
Stacktrace: [...]
source
DataToolkitBase.MissingPackageType
MissingPackage(pkg::Base.PkgId)

The package pkg was asked for, but does not seem to be available in the current environment.

Example occurrence

julia> @addpkg Bar "00000000-0000-0000-0000-000000000000"
Bar [00000000-0000-0000-0000-000000000000]

julia> @import Bar
[ Info: Lazy-loading Bar [00000000-0000-0000-0000-000000000001]
ERROR: MissingPackage: Bar [00000000-0000-0000-0000-000000000001] has been required, but does not seem to be installed.
Stacktrace: [...]
source

Data Operation exceptions

DataToolkitBase.CollectionVersionMismatchType
CollectionVersionMismatch(version::Int)

The version of the collection currently being acted on is not supported by the current version of DataToolkitBase.

Example occurrence

julia> fromspec(DataCollection, SmallDict{String, Any}("data_config_version" => -1))
ERROR: CollectionVersionMismatch: -1 (specified) ≠ 0 (current)
  The data collection specification uses the v-1 data collection format, however
  the installed DataToolkitBase version expects the v0 version of the format.
  In the future, conversion facilities may be implemented, for now though you
  will need to manually upgrade the file to the v0 format.
Stacktrace: [...]
source
DataToolkitBase.EmptyStackErrorType
EmptyStackError()

An attempt was made to perform an operation on a collection within the data stack, but the data stack is empty.

Example occurrence

julia> getlayer(nothing) # with an empty STACK
ERROR: EmptyStackError: The data collection stack is empty
Stacktrace: [...]
source
DataToolkitBase.ReadonlyCollectionType
ReadonlyCollection(collection::DataCollection)

Modification of collection is not viable, as it is read-only.

Example Occurrence

julia> lockedcollection = DataCollection(SmallDict{String, Any}("uuid" => Base.UUID(rand(UInt128)), "config" => SmallDict{String, Any}("locked" => true)))
julia> write(lockedcollection)
ERROR: ReadonlyCollection: The data collection unnamed#298 is locked
Stacktrace: [...]
source
DataToolkitBase.TransformerErrorType
TransformerError(msg::String)

A catch-all for issues involving data transformers, with details given in msg.

Example occurrence

julia> emptydata = DataSet(DataCollection(), "empty", SmallDict{String, Any}("uuid" => Base.UUID(rand(UInt128))))
DataSet empty

julia> read(emptydata)
ERROR: TransformerError: Data set "empty" could not be loaded in any form.
Stacktrace: [...]
source
DataToolkitBase.UnsatisfyableTransformerType
UnsatisfyableTransformer{T}(dataset::DataSet, types::Vector{QualifiedType})

A transformer (of type T) that could provide any of types was asked for, but there is no transformer that satisfies this restriction.

Example occurrence

julia> emptydata = DataSet(DataCollection(), "empty", SmallDict{String, Any}("uuid" => Base.UUID(rand(UInt128))))
DataSet empty

julia> read(emptydata, String)
ERROR: UnsatisfyableTransformer: There are no loaders for "empty" that can provide a String. The defined loaders are as follows:
Stacktrace: [...]
source
DataToolkitBase.OrphanDataSetType
OrphanDataSet(dataset::DataSet)

The data set (dataset) is no longer a child of its parent collection.

This error should not occur, and is intended as a sanity check should something go quite wrong.

source