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

fix: improve error message when _session_store is missing from context #67

Merged
merged 2 commits into from
Dec 17, 2021
Merged

fix: improve error message when _session_store is missing from context #67

merged 2 commits into from
Dec 17, 2021

Conversation

imclem
Copy link
Contributor

@imclem imclem commented Dec 16, 2021

Hi there 👋

I was just working with session contrib and found out that the error message when getting the session from echo context does not reflect the real cause.

I've added a test and changed the error message.

Please let me know if I'm wrong or if I need to add a separate test or modify something to comply with code style!

…text

We need to know when _session_store is missing from context and the session
middleware is not properly initialized.
@codecov
Copy link

codecov bot commented Dec 16, 2021

Codecov Report

Merging #67 (fa1aeca) into master (ed88076) will increase coverage by 0.46%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #67      +/-   ##
==========================================
+ Coverage   56.76%   57.23%   +0.46%     
==========================================
  Files           8        8              
  Lines         643      643              
==========================================
+ Hits          365      368       +3     
+ Misses        256      254       -2     
+ Partials       22       21       -1     
Impacted Files Coverage Δ
session/session.go 100.00% <100.00%> (+11.53%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ed88076...fa1aeca. Read the comment docs.

Copy link
Contributor

@aldas aldas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This look OK but please create this as separate test. Having multiple testcases in one test(run) is prone to have sideeffects. Some of our tests are tabled: for example: https://github.com/labstack/echo/blob/7bde9aea068072e08c41148fc230393872d9c49c/middleware/redirect_test.go#L14 but you do not need to have tabled.

@imclem
Copy link
Contributor Author

imclem commented Dec 17, 2021

@aldas done !

Copy link
Contributor

@aldas aldas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aldas aldas merged commit 9602c6b into labstack:master Dec 17, 2021
@imclem imclem deleted the fix/session-error-message branch December 17, 2021 08:20
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

Successfully merging this pull request may close these issues.

2 participants