Currently in NooBaa CLI when a user encounters errors related to operations that failed in the filesystem related to path in a bucket and new_buckets_path in an account - all are mapped to InternalError.
Expected behavior
When a user encounters errors related to operations that failed in the filesystem related to path in a bucket and new_buckets_path in an account with an error related specifically to them.
Steps to reproduce
It is in general, so you should find the case to fail the FS call in the flow in NooBaa CLI.
More information - Screenshots / Logs / Other output
Notes:
One can wrap each call with try... catch clause, but it would ruin the code style.
Maybe the solution will be using an helper function that would do this wrap and add the new messages.
New feature that we have is "cause" with the error stack, so if the solution will be complex, worth re-thinking about it. For example - I added a line with throw new Error('SDSD error') you can see:
{
"error": {
"code": "InternalError",
"message": "The server encountered an internal error. Please retry the request",
"cause": "Error: SDSD error\n at delete_bucket (/Users/shiradymnik/SourceCode/noobaa-core/src/cmd/manage_nsfs.js:263:19)\n at async manage_bucket_operations (/Users/shiradymnik/SourceCode/noobaa-core/src/cmd/manage_nsfs.js:294:9)\n at async bucket_management (/Users/shiradymnik/SourceCode/noobaa-core/src/cmd/manage_nsfs.js:120:5)\n at async main (/Users/shiradymnik/SourceCode/noobaa-core/src/cmd/manage_nsfs.js:96:13)"
}
}
Environment info
Actual behavior
path
in a bucket andnew_buckets_path
in an account - all are mapped toInternalError
.Expected behavior
path
in a bucket andnew_buckets_path
in an account with an error related specifically to them.Steps to reproduce
More information - Screenshots / Logs / Other output
Notes:
throw new Error('SDSD error')
you can see: