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

Populate syncthing errors to the user #1168

Merged
merged 2 commits into from
Nov 18, 2020
Merged

Populate syncthing errors to the user #1168

merged 2 commits into from
Nov 18, 2020

Conversation

pchico83
Copy link
Contributor

@pchico83 pchico83 commented Nov 17, 2020

Signed-off-by: Pablo Chico de Guzman pchico83@gmail.com

Fixes #1127 #1165

Proposed changes

  • Return a custom error with a CTA for insufficient space errors

@@ -47,7 +47,7 @@ func (s *Syncthing) Monitor(ctx context.Context, disconnect chan error) {

// MonitorStatus will send a message to disconnected if there is a synchronization error
func (s *Syncthing) MonitorStatus(ctx context.Context, disconnect chan error) {
ticker := time.NewTicker(300 * time.Second)
ticker := time.NewTicker(30 * time.Second)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we are not calling status API anymore, we can check for errors faster

@codecov
Copy link

codecov bot commented Nov 17, 2020

Codecov Report

Merging #1168 (1bd2209) into master (3213875) will increase coverage by 0.01%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1168      +/-   ##
==========================================
+ Coverage   34.54%   34.55%   +0.01%     
==========================================
  Files          65       65              
  Lines        5440     5438       -2     
==========================================
  Hits         1879     1879              
+ Misses       3358     3355       -3     
- Partials      203      204       +1     
Impacted Files Coverage Δ
cmd/pipeline/deploy.go 16.00% <0.00%> (ø)
cmd/up/up.go 3.25% <0.00%> (-0.15%) ⬇️
cmd/utils/dev.go 51.78% <0.00%> (ø)
pkg/syncthing/monitor.go 0.00% <0.00%> (ø)
pkg/syncthing/syncthing.go 0.80% <0.00%> (+0.04%) ⬆️

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 3213875...1bd2209. Read the comment docs.

E: fmt.Errorf("Deployment '%s' has been modified while your development container was active", d.Name),
Hint: "Follow these steps:\n 1. Execute 'okteto down'\n 2. Apply your manifest changes again: 'kubectl apply'\n 3. Execute 'okteto up' again\n More information is available here: https://okteto.com/docs/reference/known-issues/index.html#kubectl-apply-changes-are-undone-by-okteto-up",
E: fmt.Errorf("Deployment '%s' has been modified while your development container was active", d.Name),
Hint: `Follow these steps:
Copy link
Member

Choose a reason for hiding this comment

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

how does this look like in windows? I'm not sure if the windows terminal reacts well to this type of break line.

cmd/up/up.go Outdated
return errors.UserError{
E: err,
Hint: `The synchrinzation service is running out of space
Enable persistent volumes in your okteto manifest and try again
Copy link
Member

Choose a reason for hiding this comment

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

is this the only way to solve this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so. do you have anything in mind?

cmd/up/up.go Outdated Show resolved Hide resolved
cmd/up/up.go Outdated
return errors.UserError{
E: err,
Hint: `Okteto volume is full
Increase your persistent volume size, run 'okteto down -v' and try 'okteto up' again
Copy link
Member

Choose a reason for hiding this comment

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

are we using punctuation in the multi-line error messages? I think we should, since they are more explanation that error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are using both, I am trying to unify that here. Would you add punctuation on every line?

Copy link
Member

Choose a reason for hiding this comment

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

Yes.

Copy link
Member

Choose a reason for hiding this comment

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

I'd use punctuation in the hint, and leave the error as is. specially in these cases where the hint is more of a paragraph.

pkg/errors/errors.go Outdated Show resolved Hide resolved
@@ -394,7 +393,7 @@ func (s *Syncthing) ResetDatabase(ctx context.Context, dev *model.Dev, local boo
if err != nil {
log.Infof("error posting 'rest/system/reset' local=%t syncthing API: %s", local, err)
if strings.Contains(err.Error(), "Client.Timeout") {
return errors.ErrUnknownSyncError
return fmt.Errorf("error resetting syncthing database local=%t: %s", local, err.Error())
Copy link
Member

Choose a reason for hiding this comment

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

the 'local=' makes parsing the error harder. can we instead have a function that returns a message with the "local" or "remote" as part of the message?

Suggested change
return fmt.Errorf("error resetting syncthing database local=%t: %s", local, err.Error())
return fmt.Errorf("failed to reset syncthing database local=%t: %s", local, err.Error())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we follow this pattern in several places. would you mind opening an issue to track the change?

@derek
Copy link

derek bot commented Nov 18, 2020

Thank you for your contribution. I've just checked and your commit doesn't appear to be signed-off. That's something we need before your Pull Request can be merged. Please see our contributing guide.
Tip: if you only have one commit so far then run: git commit --amend --signoff and then git push --force.

@derek derek bot added the no-dco label Nov 18, 2020
Signed-off-by: Pablo Chico de Guzman <pchico83@gmail.com>
Signed-off-by: Pablo Chico de Guzman <pchico83@gmail.com>
@derek derek bot removed the no-dco label Nov 18, 2020
@pchico83 pchico83 merged commit 2557bc0 into master Nov 18, 2020
@pchico83 pchico83 deleted the no-space-error branch November 18, 2020 07:46
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.

Syncthing errors not propagated properly
2 participants