Description
Sometimes libgit2
functions return large negative numbers, representing non-libgit2 errors (usually network errors), but the current Enum type (LibGit2.Error.Code
) cannot contain them.
julia/stdlib/LibGit2/src/error.jl
Line 37 in 5835c3b
julia/stdlib/LibGit2/src/error.jl
Lines 82 to 86 in 5835c3b
julia/stdlib/LibGit2/src/error.jl
Lines 103 to 107 in 5835c3b
An ArgumentError: invalid value for Enum Code
is thrown when the error code abs(err_code) > 40
.
An example: https://buildkite.com/julialang/julia-master/builds/42812#01939979-4dae-44ed-9e39-1f693a963576/863-969
Pkg (2) | failed at 2024-12-06T01:22:16.609
Error During Test at /cache/build/tester-demeter6-11/julialang/julia-master/julia-8c760fdc68/share/julia/stdlib/v1.12/Pkg/test/sources.jl:8
Got exception outside of a @test
ArgumentError: invalid value for Enum Code: -30848
Stacktrace:
[1] enum_argument_error(typename::Symbol, x::Int32)
@ Base.Enums ./Enums.jl:93
[2] Code
@ ./Enums.jl:212 [inlined]
[3] LibGit2.Error.GitError(err_code::Int32)
@ LibGit2.Error /cache/build/tester-demeter6-11/julialang/julia-master/julia-8c760fdc68/share/julia/stdlib/v1.12/LibGit2/src/error.jl:103
[4] macro expansion
@ /cache/build/tester-demeter6-11/julialang/julia-master/julia-8c760fdc68/share/julia/stdlib/v1.12/LibGit2/src/error.jl:115 [inlined]
[5] clone(repo_url::SubString{String}, repo_path::String, clone_opts::LibGit2.CloneOptions)
@ LibGit2 /cache/build/tester-demeter6-11/julialang/julia-master/julia-8c760fdc68/share/julia/stdlib/v1.12/LibGit2/src/repository.jl:470
[6] clone(repo_url::SubString{String}, repo_path::String; branch::String, isbare::Bool, remote_cb::Ptr{Nothing}, credentials::LibGit2.CachedCredentials, callbacks::Dict{Symbol, Tuple{Ptr{Nothing}, Any}})
@ LibGit2 /cache/build/tester-demeter6-11/julialang/julia-master/julia-8c760fdc68/share/julia/stdlib/v1.12/LibGit2/src/LibGit2.jl:584
[7] clone
@ /cache/build/tester-demeter6-11/julialang/julia-master/julia-8c760fdc68/share/julia/stdlib/v1.12/LibGit2/src/LibGit2.jl:557 [inlined]
Perhaps the type restriction on GitError.code
could be relaxed to cover these errors.
struct GitError <: Exception
class::Class
- code::Code
+ code::Union{Code, Int32}
msg::String
end
Activity