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

Improvement of error message when resolution ID does not exist #210

Open
cmglastra opened this issue Mar 14, 2024 · 0 comments
Open

Improvement of error message when resolution ID does not exist #210

cmglastra opened this issue Mar 14, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@cmglastra
Copy link

When using bu-isciii tools with a resolution ID that does not exist (for example, for service ID SRVCNM1078, only SRVCNM1078.1 exists):

bu-isciii scratch --direction service_to_scratch SRVCNM1078.2

the following error message appears:

───────────────────────── Traceback (most recent call last) ──────────────────────────────────╮
│ /data/bi/pipelines/miniconda3/envs/buisciii-tools/bin/bu-isciii:8 in <module>                         │
│                                                                                                       │
│   7 │   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                              │
│ ❱ 8 │   sys.exit(run_bu_isciii())                                                                     │
│   9                                                                                                   │
│                                                                                                       │
│ /data/bi/pipelines/miniconda3/envs/buisciii-tools/lib/python3.9/site-packages/bu_isciii/main.py:6 │
│ 4 in run_bu_isciii                                                                                    │
│                                                                                                       │
│    63 │   # Lanch the click cli                                                                       │
│ ❱  64 │   bu_isciii_cli()                                                                             │
│    65                                                                                                 │
│                                                                                                       │
│ /data/bi/pipelines/miniconda3/envs/buisciii-tools/lib/python3.9/site-packages/click/core.py:1130 in   │
│ call                                                                                              │
│                                                                                                       │
│   1129 │   │   """Alias for :meth:main."""                                                          │
│ ❱ 1130 │   │   return self.main(*args, **kwargs)                                                      │
│   1131                                                                                                │
│                                                                                                       │
│ /data/bi/pipelines/miniconda3/envs/buisciii-tools/lib/python3.9/site-packages/click/core.py:1055 in   │
│ main                                                                                                  │
│                                                                                                       │
│   1054 │   │   │   │   with self.make_context(prog_name, args, **extra) as ctx:                       │
│ ❱ 1055 │   │   │   │   │   rv = self.invoke(ctx)                                                      │
│   1056 │   │   │   │   │   if not standalone_mode:                                                    │
│                                                                                                       │
│ /data/bi/pipelines/miniconda3/envs/buisciii-tools/lib/python3.9/site-packages/click/core.py:1657 in   │
│ invoke                                                                                                │
│                                                                                                       │
│   1656 │   │   │   │   with sub_ctx:                                                                  │
│ ❱ 1657 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))                    │
│   1658                                                                                                │
│                                                                                                       │
│ /data/bi/pipelines/miniconda3/envs/buisciii-tools/lib/python3.9/site-packages/click/core.py:1404 in   │
│ invoke                                                                                                │
│                                                                                                       │
│   1403 │   │   if self.callback is not None:                                                          │
│ ❱ 1404 │   │   │   return ctx.invoke(self.callback, **ctx.params)                                     │
│   1405                                                                                                │
│                                                                                                       │
│ /data/bi/pipelines/miniconda3/envs/buisciii-tools/lib/python3.9/site-packages/click/core.py:760 in    │
│ invoke                                                                                                │
│                                                                                                       │
│    759 │   │   │   with ctx:                                                                          │
│ ❱  760 │   │   │   │   return __callback(*args, **kwargs)                                             │
│    761                                                                                                │
│                                                                                                       │
│ /data/bi/pipelines/miniconda3/envs/buisciii-tools/lib/python3.9/site-packages/click/decorators.py:26  │
│ in new_func                                                                                           │
│                                                                                                       │
│    25 │   def new_func(*args, **kwargs):  # type: ignore                                              │
│ ❱  26 │   │   return f(get_current_context(), *args, **kwargs)                                        │
│    27                                                                                                 │
│                                                                                                       │
│ /data/bi/pipelines/miniconda3/envs/buisciii-tools/lib/python3.9/site-packages/bu_isciii/main.py:2 │
│ 59 in scratch                                                                                         │
│                                                                                                       │
│   258 │   """                                                                                         │
│ ❱ 259 │   scratch_copy = bu_isciii.scratch.Scratch(                                                   │
│   260 │   │   resolution,                                                                             │
│                                                                                                       │
│ /data/bi/pipelines/miniconda3/envs/buisciii-tools/lib/python3.9/site-packages/bu_isciii/scratch.py:70 │
│ in init                                                                                           │
│                                                                                                       │
│    69 │   │   )                                                                                       │
│ ❱  70 │   │   self.service_folder = self.resolution_info["resolutions"][0][                           │
│    71 │   │   │   "resolution_full_number"                                                            │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: 'int' object is not subscriptable

This error should be catched as: "Resolution SRVCNM1078.2 does not exist for service SRVCNM1078"

@Shettland Shettland self-assigned this Apr 10, 2024
@Shettland Shettland added the bug Something isn't working label Apr 10, 2024
@saramonzon saramonzon assigned saramonzon and unassigned Shettland Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants