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

Improve error messaging when trying to attach a service connected to another account #259

Merged
merged 3 commits into from
Jan 1, 2022

Conversation

raccube
Copy link
Contributor

@raccube raccube commented Jan 1, 2022

Closes #209

@raccube raccube requested a review from nilsding as a code owner January 1, 2022 17:59
@codecov
Copy link

codecov bot commented Jan 1, 2022

Codecov Report

Merging #259 (9ce1fc0) into master (5ffce61) will increase coverage by 1.42%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #259      +/-   ##
==========================================
+ Coverage   66.99%   68.42%   +1.42%     
==========================================
  Files          94       94              
  Lines        2136     2128       -8     
==========================================
+ Hits         1431     1456      +25     
+ Misses        705      672      -33     
Impacted Files Coverage Δ
app/controllers/services_controller.rb 66.66% <80.00%> (+66.66%) ⬆️
app/models/service.rb 88.88% <0.00%> (+27.77%) ⬆️

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 5ffce61...9ce1fc0. Read the comment docs.

Copy link
Member

@nilsding nilsding left a comment

Choose a reason for hiding this comment

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

Please add some tests

if service.errors.details.has_key?(:uid) && service.errors.details[:uid].any? { |err| err[:error] == :taken }
flash[:error] = "The #{service.type.split('::').last.titleize} account you are trying to connect is already connected to another #{APP_CONFIG['site_name']} account."
else
flash[:error] = t('flash.service.create.error') + service.errors.inspect
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
flash[:error] = t('flash.service.create.error') + service.errors.inspect
flash[:error] = t('flash.service.create.error')

app/controllers/services_controller.rb Outdated Show resolved Hide resolved
spec/controllers/services_controller_spec.rb Outdated Show resolved Hide resolved
Co-authored-by: Georg Gadinger <nilsding@nilsding.org>
@raccube raccube merged commit a04031d into master Jan 1, 2022
@raccube raccube deleted the service-attach-errors branch January 1, 2022 21:33
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.

Error messages for attaching services aren't very helpful
2 participants