noobaa-core icon indicating copy to clipboard operation
noobaa-core copied to clipboard

NC | NSFS | Improve The Errors Related to `path` and `new_buckets_path`

Open shirady opened this issue 7 months ago • 1 comments

Environment info

  • NooBaa Version: 5.17 (master, current code)
  • Platform: NC

Actual behavior

  1. 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

  1. 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

  1. 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)"
  }
}

shirady avatar Jul 08 '24 13:07 shirady