ChifiSource / Olive.jl

pure julia notebooks
MIT License
152 stars 6 forks source link

🐣 Create client_data Dict if it does not exist yet #60

Closed fonsp closed 1 year ago

fonsp commented 1 year ago

Hello!! πŸ‘‹

I tried Olive for the first time and it did not work :( After giving my name in the setup wizard, the terminal showed this error and the progress bar got stuck:

β”Œ Error: handle_connection handler error
β”‚   exception =
β”‚    KeyError: key "fonzyy" not found
β”‚    Stacktrace:
β”‚     [1] getindex(h::Dict{String, Dict{String, Any}}, key::String)
β”‚       @ Base ./dict.jl:484
β”‚     [2] (::Olive.var"#262#266")(c::Toolips.Connection)
β”‚       @ Olive ~/.julia/packages/Olive/YuQss/src/Olive.jl:177
β”‚     [3] (::Toolips.var"#serve#63"{Vector{Toolips.AbstractRoute}, String, Vector{Toolips.ServerExtension}, Vector{Toolips.ServerExtension}})(http::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Connection{Sockets.TCPSocket}})
β”‚       @ Toolips ~/.julia/packages/Toolips/L3oiV/src/server/Core.jl:0
β”‚     [4] #invokelatest#2
β”‚       @ ./essentials.jl:816 [inlined]
β”‚     [5] invokelatest
β”‚       @ ./essentials.jl:813 [inlined]
β”‚     [6] handle_connection(f::Function, c::HTTP.ConnectionPool.Connection{Sockets.TCPSocket}, listener::HTTP.Servers.Listener{Nothing, Sockets.TCPServer}, readtimeout::Int64, access_log::Nothing)
β”‚       @ HTTP.Servers ~/.julia/packages/HTTP/z8l0i/src/Servers.jl:447
β”‚     [7] macro expansion
β”‚       @ ~/.julia/packages/HTTP/z8l0i/src/Servers.jl:385 [inlined]
β”‚     [8] (::HTTP.Servers.var"#16#17"{Toolips.var"#serve#63"{Vector{Toolips.AbstractRoute}, String, Vector{Toolips.ServerExtension}, Vector{Toolips.ServerExtension}}, HTTP.Servers.Listener{Nothing, Sockets.TCPServer}, Set{HTTP.ConnectionPool.Connection}, Int64, Nothing, Base.Semaphore, HTTP.ConnectionPool.Connection{Sockets.TCPSocket}})()
β”‚       @ HTTP.Servers ./task.jl:514
β”” @ HTTP.Servers ~/.julia/packages/HTTP/z8l0i/src/Servers.jl:461

This PR fixed the error πŸŽ‰ I was not sure what the type of the Dict should be, so I used Dict{Any,Any}, but maybe you want to change this to Dict{String,String} or something else.

Looking forward to try Olive!!

emmaccode commented 1 year ago

merged! thanks :)

emmaccode commented 1 year ago

I believe what happened with your error, by the way, is that OliveDefaults is not yet addable (due to Olive not being in the registry,) and then the progress bar got stuck because the package name could not be found (I meant to switch the buttons around to have no be the default anyway,) but the addition of OliveDefaults happens just before the client info is saved and loaded into the OliveCore, I am presuming that when it got stuck you refreshed the page, and this gave you the error if this is the case. Certainly is nice to have a catchall, though, only makes sense if the key is already authenticated.