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

Print more error info for minio #136

Merged
merged 2 commits into from
Aug 15, 2022
Merged

Print more error info for minio #136

merged 2 commits into from
Aug 15, 2022

Conversation

MaxJa4
Copy link
Contributor

@MaxJa4 MaxJa4 commented Jul 21, 2022

Could help debugging #134 since Minio should be able to handle retrying...
The ErrorResponse type contains a lot more info.

Since it's no fix and just helps finding the issue, I created the PR as draft. It may help tracking down Minio issues in the future or help the user with more verbose errors. Feel free to close this if there is no need.

@m90
Copy link
Member

m90 commented Jul 22, 2022

Were you able to test this? I like the idea, but I am not sure if it actually makes a difference because of the following: if you're using the %w verb in the fmt.Errorf template, an error type is expected. The error interface is implemented on ErrorResponse, but it just returns the Message when calling Error, which is probably the very same result as we have right now. I.e. we'd be casting the error to an ErrorResponse and back again.

I think the proper approach here would be casting to an ErrorResponse and the manually constructing the error message, populating it with relevant information ourselves.

@MaxJa4
Copy link
Contributor Author

MaxJa4 commented Jul 22, 2022

I did not experiment with it yet, since I wanted to wait for your input as you said (in the underlying issue) that you will have a look yourself too.

I can try to provoke a failed copyBackup operation. Idk yet how I would let it intentionally fail (as I would prefer to do that with a real B2 bucket to see what info is available). Perhaps setting the permissions too low so it fails, we'll see.

I will update the draft accordingly in regards to the error info printing.

@m90
Copy link
Member

m90 commented Jul 22, 2022

I can try to provoke a failed copyBackup operation

The easiest way I can think of would be to point the setup towards an inexistent bucket.

@MaxJa4
Copy link
Contributor Author

MaxJa4 commented Jul 22, 2022

You were right, it had to be unpacked.
It now looks like this when using the non existant 'invalid-bucket':
time="2022-07-22T16:00:44+02:00" level=error msg="Fatal error running backup: copyBackup: error uploading backup to remote storage: [Message]: 'The specified bucket does not exist: invalid-bucket', [Code]: NoSuchBucket, [StatusCode]: 404"

Copy link
Member

@m90 m90 left a comment

Choose a reason for hiding this comment

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

Looks great. I'll wait with merging this until I do the next release, but it's definitely a great addition, thank you very much.

@m90 m90 marked this pull request as ready for review July 22, 2022 14:26
@m90 m90 merged commit 2b7f0c5 into offen:main Aug 15, 2022
m90 pushed a commit that referenced this pull request Aug 18, 2022
* Added abstract helper interface and implemented it for all storage backends

* Moved storage client initializations also to helper classes

* Fixed ssh init issue

* Moved script parameter to helper struct to simplify script init.

* Created sub modules. Enhanced abstract implementation.

* Fixed config issue

* Fixed declaration issues. Added config to interface.

* Added StorageProviders to unify all backends.

* Cleanup, optimizations, comments.

* Applied discussed changes. See description.

Moved modules to internal packages.
Replaced StoragePool with slice.
Moved conditional for init of storage backends back to script.

* Fix docker build issue

* Fixed accidentally removed local copy condition.

* Delete .gitignore

* Renaming/changes according to review

Renamed Init functions and interface.
Replaced config object with specific config values.
Init func returns interface instead of struct.
Removed custom import names where possible.

* Fixed auto-complete error.

* Combined copy instructions into one layer.

* Added logging func for storages.

* Introduced logging func for errors too.

* Missed an error message

* Moved config back to main. Optimized prune stats handling.

* Move stats back to main package

* Code doc stuff

* Apply changes from #136

* Replace name field with function.

* Changed receiver names from stg to b.

* Renamed LogFuncDef to Log

* Removed redundant package name.

* Renamed storagePool to storages.

* Simplified creation of new storage backend.

* Added initialization for storage stats map.

* Invert .dockerignore patterns.

* Fix package typo
@MaxJa4 MaxJa4 deleted the enhancement/more-minio-error-info branch August 18, 2022 08:50
m90 pushed a commit that referenced this pull request Aug 18, 2022
* Added abstract helper interface and implemented it for all storage backends

* Moved storage client initializations also to helper classes

* Fixed ssh init issue

* Moved script parameter to helper struct to simplify script init.

* Created sub modules. Enhanced abstract implementation.

* Fixed config issue

* Fixed declaration issues. Added config to interface.

* Added StorageProviders to unify all backends.

* Cleanup, optimizations, comments.

* Applied discussed changes. See description.

Moved modules to internal packages.
Replaced StoragePool with slice.
Moved conditional for init of storage backends back to script.

* Fix docker build issue

* Fixed accidentally removed local copy condition.

* Delete .gitignore

* Renaming/changes according to review

Renamed Init functions and interface.
Replaced config object with specific config values.
Init func returns interface instead of struct.
Removed custom import names where possible.

* Fixed auto-complete error.

* Combined copy instructions into one layer.

* Added logging func for storages.

* Introduced logging func for errors too.

* Missed an error message

* Moved config back to main. Optimized prune stats handling.

* Move stats back to main package

* Code doc stuff

* Apply changes from #136

* Replace name field with function.

* Changed receiver names from stg to b.

* Renamed LogFuncDef to Log

* Removed redundant package name.

* Renamed storagePool to storages.

* Simplified creation of new storage backend.

* Added initialization for storage stats map.

* Invert .dockerignore patterns.

* Fix package typo
m90 pushed a commit that referenced this pull request Aug 18, 2022
* Added abstract helper interface and implemented it for all storage backends

* Moved storage client initializations also to helper classes

* Fixed ssh init issue

* Moved script parameter to helper struct to simplify script init.

* Created sub modules. Enhanced abstract implementation.

* Fixed config issue

* Fixed declaration issues. Added config to interface.

* Added StorageProviders to unify all backends.

* Cleanup, optimizations, comments.

* Applied discussed changes. See description.

Moved modules to internal packages.
Replaced StoragePool with slice.
Moved conditional for init of storage backends back to script.

* Fix docker build issue

* Fixed accidentally removed local copy condition.

* Delete .gitignore

* Renaming/changes according to review

Renamed Init functions and interface.
Replaced config object with specific config values.
Init func returns interface instead of struct.
Removed custom import names where possible.

* Fixed auto-complete error.

* Combined copy instructions into one layer.

* Added logging func for storages.

* Introduced logging func for errors too.

* Missed an error message

* Moved config back to main. Optimized prune stats handling.

* Move stats back to main package

* Code doc stuff

* Apply changes from #136

* Replace name field with function.

* Changed receiver names from stg to b.

* Renamed LogFuncDef to Log

* Removed redundant package name.

* Renamed storagePool to storages.

* Simplified creation of new storage backend.

* Added initialization for storage stats map.

* Invert .dockerignore patterns.

* Fix package typo
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.

None yet

2 participants