Skip to content

Commit 1f91f2e

Browse files
committed
Add a more informative error message, when no backend is loaded.
1 parent 6fb91d7 commit 1f91f2e

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/datasets/datasetinterface.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ backendregex = Pair[]
7878

7979
function backendfrompath(g::String; driver = :all)
8080
if driver == :all
81+
isempty(backendregex) && throw("No backend found. Load a backend by using the corresponding package.")
8182
for p in YAXArrayBase.backendregex
8283
if match(p[1],g) !== nothing
8384
return p[2]

test/datasets.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
using YAXArrayBase, NetCDF, Zarr, Test
1+
using YAXArrayBase, Test
2+
@testset "Empty Backend" begin
3+
@test_throws "No backend found." YAXArrayBase.backendfrompath("test.zarr")
4+
end
5+
6+
using NetCDF, Zarr
27

38
@testset "Reading NetCDF" begin
49
import Downloads

test/runtests.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
using YAXArrayBase
22
using Test
3-
@testset "Arrays" begin
4-
include("arrays.jl")
5-
end
3+
64
@testset "Datasets" begin
75
include("datasets.jl")
86
end
7+
@testset "Arrays" begin
8+
include("arrays.jl")
9+
end

0 commit comments

Comments
 (0)