Skip to content

Commit

Permalink
better error messages in test codec
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 committed Feb 27, 2024
1 parent 3b1d67a commit 6f41083
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/codecdoubleframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function TranscodingStreams.process(
Δout::Int = 0

function do_read(ref)
iszero(input.size) && error("Expected byte")
iszero(input.size) && error("expected byte")
if Δin + 1 lastindex(input)
Δin += 1
ref[] = input[Δin]
Expand Down Expand Up @@ -134,6 +134,10 @@ function TranscodingStreams.process(
@goto state4
elseif oldstate == 5
@goto state5
elseif oldstate == 6
error("cannot process after ending")
elseif oldstate == 7
error("cannot process after erroring")
else
error("unexpected state $(oldstate)")
end
Expand All @@ -158,8 +162,10 @@ function TranscodingStreams.process(
error("expected matching bytes or space and ]")
end
end
codec.state[]=6
return Δin, Δout, :end
catch e
codec.state[]=7
e isa ErrorException || rethrow()
error[] = e
return Δin, Δout, :error
Expand Down

0 comments on commit 6f41083

Please sign in to comment.