Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch Pkg errors and display a nicer error instead #42

Open
SaschaMann opened this issue Sep 8, 2021 · 0 comments
Open

Catch Pkg errors and display a nicer error instead #42

SaschaMann opened this issue Sep 8, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@SaschaMann
Copy link
Contributor

SaschaMann commented Sep 8, 2021

When a student tries to load a package through Pkg.add, the error is rather cryptic. We could probably catch that and display a nicer error instead.

Or overload Pkg methods with a simple error message like Pkg operations are not supported by the test runner.

LoadError: LoadError: failed to clone from https://github.com/JuliaArrays/OffsetArrays.jl, error: GitError(Code:ERROR, Class:Net, failed to resolve address for github.com: Temporary failure in name resolution)
Stacktrace:
  [1] pkgerror(msg::String)
    @ Pkg.Types [...]/julia/stdlib/v1.6/Pkg/src/Types.jl:55
  [2] clone(ctx::Pkg.Types.Context, url::String, source_path::String; header::Nothing, credentials::Nothing, kwargs::Base.Iterators.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:isbare,), Tuple{Bool}}})
    @ Pkg.GitTools [...]/julia/stdlib/v1.6/Pkg/src/GitTools.jl:119
  [3] #ensure_clone#2
    @ [...]/julia/stdlib/v1.6/Pkg/src/GitTools.jl:72 [inlined]
  [4] handle_repo_add!(ctx::Pkg.Types.Context, pkg::Pkg.Types.PackageSpec)
    @ Pkg.Types [...]/julia/stdlib/v1.6/Pkg/src/Types.jl:619
  [5] handle_repos_add!(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.Types [...]/julia/stdlib/v1.6/Pkg/src/Types.jl:686
  [6] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API [...]/julia/stdlib/v1.6/Pkg/src/API.jl:177
  [7] add
    @ [...]/julia/stdlib/v1.6/Pkg/src/API.jl:148 [inlined]
  [8] add(pkgs::Vector{Pkg.Types.PackageSpec}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API [...]/julia/stdlib/v1.6/Pkg/src/API.jl:73
  [9] add
    @ [...]/julia/stdlib/v1.6/Pkg/src/API.jl:72 [inlined]
 [10] #add#20
    @ [...]/julia/stdlib/v1.6/Pkg/src/API.jl:69 [inlined]
 [11] add
    @ [...]/julia/stdlib/v1.6/Pkg/src/API.jl:69 [inlined]
 [12] add(; name::Nothing, uuid::Nothing, version::Nothing, url::String, rev::Nothing, path::Nothing, mode::Pkg.Types.PackageMode, subdir::Nothing, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API [...]/julia/stdlib/v1.6/Pkg/src/API.jl:91
 [13] top-level scope
    @ ./pangram.jl:2
 [14] include(mod::Module, _path::String)
    @ Base ./Base.jl:386
 [15] include(x::String)
    @ ExercismTestReports ~/.julia/packages/ExercismTestReports/Ov0Sg/src/ExercismTestReports.jl:1
 [16] top-level scope
    @ ./runtests.jl:3
 [17] include(mod::Module, _path::String)
    @ Base ./Base.jl:386
 [18] include
    @ ~/.julia/packages/ExercismTestReports/Ov0Sg/src/ExercismTestReports.jl:1 [inlined]
 [19] macro expansion
    @ ~/.julia/packages/ExercismTestReports/Ov0Sg/src/runner.jl:14 [inlined]
 [20] macro expansion
    @ [...]/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
 [21] macro expansion
    @ ~/.julia/packages/ExercismTestReports/Ov0Sg/src/runner.jl:14 [inlined]
 [22] macro expansion
    @ ~/.julia/packages/Suppressor/nTjgZ/src/Suppressor.jl:127 [inlined]
 [23] runtests(testfile::String)
    @ ExercismTestReports ~/.julia/packages/ExercismTestReports/Ov0Sg/src/runner.jl:13
 [24] test_runner(exercise_slug::String, solution_dir::String)
    @ ExercismTestReports ~/.julia/packages/ExercismTestReports/Ov0Sg/src/ExercismTestReports.jl:18
 [25] test_runner(exercise_slug::String, solution_dir::String, output_dir::String)
    @ ExercismTestReports ~/.julia/packages/ExercismTestReports/Ov0Sg/src/ExercismTestReports.jl:39
 [26] top-level scope
    @ /opt/test-runner/run.jl:3
 [27] include(mod::Module, _path::String)
    @ Base ./Base.jl:386
 [28] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:285
 [29] _start()
    @ Base ./client.jl:485
in expression starting at ./pangram.jl:2
in expression starting at ./runtests.jl:3

caused by: GitError(Code:ERROR, Class:Net, failed to resolve address for github.com: Temporary failure in name resolution)
Stacktrace:
  [1] macro expansion
    @ [...]/julia/stdlib/v1.6/LibGit2/src/error.jl:110 [inlined]
  [2] clone(repo_url::SubString{String}, repo_path::String, clone_opts::LibGit2.CloneOptions)
    @ LibGit2 [...]/julia/stdlib/v1.6/LibGit2/src/repository.jl:459
  [3] 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 [...]/julia/stdlib/v1.6/LibGit2/src/LibGit2.jl:583
  [4] clone(ctx::Pkg.Types.Context, url::String, source_path::String; header::Nothing, credentials::Nothing, kwargs::Base.Iterators.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:isbare,), Tuple{Bool}}})
    @ Pkg.GitTools [...]/julia/stdlib/v1.6/Pkg/src/GitTools.jl:109
  [5] #ensure_clone#2
    @ [...]/julia/stdlib/v1.6/Pkg/src/GitTools.jl:72 [inlined]
  [6] handle_repo_add!(ctx::Pkg.Types.Context, pkg::Pkg.Types.PackageSpec)
    @ Pkg.Types [...]/julia/stdlib/v1.6/Pkg/src/Types.jl:619
  [7] handle_repos_add!(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.Types [...]/julia/stdlib/v1.6/Pkg/src/Types.jl:686
  [8] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API [...]/julia/stdlib/v1.6/Pkg/src/API.jl:177
  [9] add
    @ [...]/julia/stdlib/v1.6/Pkg/src/API.jl:148 [inlined]
 [10] add(pkgs::Vector{Pkg.Types.PackageSpec}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API [...]/julia/stdlib/v1.6/Pkg/src/API.jl:73
 [11] add
    @ [...]/julia/stdlib/v1.6/Pkg/src/API.jl:72 [inlined]
 [12] #add#20
    @ [...]/julia/stdlib/v1.6/Pkg/src/API.jl:69 [inlined]
 [13] add
    @ [...]/julia/stdlib/v1.6/Pkg/src/API.jl:69 [inlined]
 [14] add(; name::Nothing, uuid::Nothing, version::Nothing, url::String, rev::Nothing, path::Nothing, mode::Pkg.Types.PackageMode, subdir::Nothing, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API [...]/julia/stdlib/v1.6/Pkg/src/API.jl:91
 [15] top-level scope
    @ ./pangram.jl:2
 [16] include(mod::Module, _path::String)
    @ Base ./Base.jl:386
 [17] include(x::String)
    @ ExercismTestReports ~/.julia/packages/ExercismTestReports/Ov0Sg/src/ExercismTestReports.jl:1
 [18] top-level scope
    @ ./runtests.jl:3
 [19] include(mod::Module, _path::String)
    @ Base ./Base.jl:386
 [20] include
    @ ~/.julia/packages/ExercismTestReports/Ov0Sg/src/ExercismTestReports.jl:1 [inlined]
 [21] macro expansion
    @ ~/.julia/packages/ExercismTestReports/Ov0Sg/src/runner.jl:14 [inlined]
 [22] macro expansion
    @ [...]/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
 [23] macro expansion
    @ ~/.julia/packages/ExercismTestReports/Ov0Sg/src/runner.jl:14 [inlined]
 [24] macro expansion
    @ ~/.julia/packages/Suppressor/nTjgZ/src/Suppressor.jl:127 [inlined]
 [25] runtests(testfile::String)
    @ ExercismTestReports ~/.julia/packages/ExercismTestReports/Ov0Sg/src/runner.jl:13
 [26] test_runner(exercise_slug::String, solution_dir::String)
    @ ExercismTestReports ~/.julia/packages/ExercismTestReports/Ov0Sg/src/ExercismTestReports.jl:18
 [27] test_runner(exercise_slug::String, solution_dir::String, output_dir::String)
    @ ExercismTestReports ~/.julia/packages/ExercismTestReports/Ov0Sg/src/ExercismTestReports.jl:39
 [28] top-level scope
    @ /opt/test-runner/run.jl:3
 [29] include(mod::Module, _path::String)
    @ Base ./Base.jl:386
 [30] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:285
 [31] _start()
    @ Base ./client.jl:485
@cmcaine cmcaine added the enhancement New feature or request label Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants