When a registry isn't found we should handle the problem more elegantly #1

Open
opened 2026-07-26 23:05:22 +01:00 by esilva · 1 comment
Owner

Right now we get something like:

Traceback (most recent call last):
  File "/home/esilva/Desktop/projetos/taskrunner/playbook/__init__.py", line 258, in __from_yaml_str
    regs = cls.__load_registry_file(full_path)
  File "/home/esilva/Desktop/projetos/taskrunner/playbook/__init__.py", line 142, in __load_registry_file
    spec.loader.exec_module(module)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 758, in exec_module
  File "<frozen importlib._bootstrap_external>", line 895, in get_code
  File "<frozen importlib._bootstrap_external>", line 953, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/home/esilva/Desktop/projetos/taskrunner/registry/restic_ctions.py'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/esilva/Desktop/projetos/taskrunner/taskrunner.py", line 40, in main
    newPlay = Play.from_yaml(args.playbook, registries=extra_regs)
  File "/home/esilva/Desktop/projetos/taskrunner/playbook/__init__.py", line 238, in from_yaml
    return cls.__from_yaml_str(file_contents, base_dir=yaml_dir)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/esilva/Desktop/projetos/taskrunner/playbook/__init__.py", line 261, in __from_yaml_str
    raise PlaybookError(f"Error loading registry '{reg_path}': {e}") from e
playbook.PlaybookError: Error loading registry './registry/restic_ctions.py': [Errno 2] No such file or directory: '/home/esilva/Desktop/projetos/taskrunner/registry/restic_ctions.py'
jq: parse error: Invalid numeric literal at line 1, column 7

We should be throwing an error log for every action

Right now we get something like: ``` Traceback (most recent call last): File "/home/esilva/Desktop/projetos/taskrunner/playbook/__init__.py", line 258, in __from_yaml_str regs = cls.__load_registry_file(full_path) File "/home/esilva/Desktop/projetos/taskrunner/playbook/__init__.py", line 142, in __load_registry_file spec.loader.exec_module(module) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^ File "<frozen importlib._bootstrap_external>", line 758, in exec_module File "<frozen importlib._bootstrap_external>", line 895, in get_code File "<frozen importlib._bootstrap_external>", line 953, in get_data FileNotFoundError: [Errno 2] No such file or directory: '/home/esilva/Desktop/projetos/taskrunner/registry/restic_ctions.py' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/esilva/Desktop/projetos/taskrunner/taskrunner.py", line 40, in main newPlay = Play.from_yaml(args.playbook, registries=extra_regs) File "/home/esilva/Desktop/projetos/taskrunner/playbook/__init__.py", line 238, in from_yaml return cls.__from_yaml_str(file_contents, base_dir=yaml_dir) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/esilva/Desktop/projetos/taskrunner/playbook/__init__.py", line 261, in __from_yaml_str raise PlaybookError(f"Error loading registry '{reg_path}': {e}") from e playbook.PlaybookError: Error loading registry './registry/restic_ctions.py': [Errno 2] No such file or directory: '/home/esilva/Desktop/projetos/taskrunner/registry/restic_ctions.py' jq: parse error: Invalid numeric literal at line 1, column 7 ``` We should be throwing an error log for every action
Author
Owner

List of paths we have to fix so far:

  • when a function isn't present in any registry
  • errors in the yaml file parsing
  • when a registry file can't be found (wrong name/path)
List of paths we have to fix so far: - when a function isn't present in any registry - errors in the yaml file parsing - when a registry file can't be found (wrong name/path)
esilva self-assigned this 2026-07-26 23:36:48 +01:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: esilva/taskrunner#1