From 707d815b01a00b2ba40561bcf3c962a0d0ac4d53 Mon Sep 17 00:00:00 2001 From: Michiel Cottaar <michiel.cottaar@ndcn.ox.ac.uk> Date: Mon, 26 Feb 2024 10:06:34 +0000 Subject: [PATCH] Fix sequences for which no pathway is defined --- src/pathways.jl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pathways.jl b/src/pathways.jl index 1300388..df977a9 100644 --- a/src/pathways.jl +++ b/src/pathways.jl @@ -3,7 +3,7 @@ import LinearAlgebra: norm, tr import StaticArrays: SVector, SMatrix import ..Components: NoGradient, RFPulseComponent, ReadoutComponent, InstantGradient, GradientWaveform, DelayedEvent import ..Containers: BaseSequence, Sequence, BaseBuildingBlock, waveform, events, waveform_sequence, start_time, AlternativeBlocks -import ..Variables: qvec, qval, qval3, bmat_gradient, VariableType, effective_time, duration, TR, bmat, bval, area_under_curve, duration_dephase, duration_transverse +import ..Variables: qvec, qval, qval3, bmat_gradient, VariableType, effective_time, duration, TR, bmat, bval, area_under_curve, duration_dephase, duration_transverse, VariableNotAvailable """ @@ -170,7 +170,14 @@ function get_pathway end for fn in (:qvec, :area_under_curve, :bmat, :bval, :duration_dephase, :duration_transverse) @eval function $fn(seq::Sequence) - pathway = get_pathway(seq) + pathway = try + get_pathway(seq) + catch e + if e isa MethodError + throw(VariableNotAvailable(typeof(seq), $fn)) + end + rethrow() + end if pathway isa Pathway return $fn(pathway) elseif pathway isa AbstractVector || pathway isa Tuple -- GitLab