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

Remove use of @asserts in some areas? #27

Open
DilumAluthge opened this issue Jan 22, 2024 · 0 comments
Open

Remove use of @asserts in some areas? #27

DilumAluthge opened this issue Jan 22, 2024 · 0 comments

Comments

@DilumAluthge
Copy link

I've noticed some uses of @assert, e.g.

JWTs.jl/src/JWTs.jl

Lines 114 to 117 in 8eeb318

function kid(jwt::JWT)::String
@assert issigned(jwt)
get(decodepart(jwt.header), "kid", nothing)
end

In a future minor version of Julia, @asserts may be disabled by default.

Therefore, I think that most (if not all) uses of @assert in this package should be removed and replaced with regular errors, e.g.

function kid(jwt::JWT)::String 
     issigned(jwt) || throw(ArgumentError("jwt is not signed"))
     get(decodepart(jwt.header), "kid", nothing) 
 end 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant