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

Improve error message when trying to run a plan that does not exist from the CLI client #311

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DiamondJoseph
Copy link
Collaborator

Comment on lines 10 to +14
class BlueskyRemoteError(Exception):
def __init__(self, message: str) -> None:
super().__init__(message)
response: Response

def __init__(self, message: Response) -> None:
self.response = message
Copy link
Collaborator

Choose a reason for hiding this comment

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

This de-generliases the exception to be dependant on HTTP. Could make it optional, or make a new, specific exception.

Copy link
Collaborator

Choose a reason for hiding this comment

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

bluesky remote is only http rest at the moment, right?

we could generalize when we need to

Comment on lines +164 to +165
if e.response.status_code == 404:
print(f'Plan "{name}" not found')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should the server-side API provide a human-readable message in this case?

@stan-dot
Copy link
Collaborator

        task = Task(name=name, params=parsed_params)
        resp = client.create_task(task)
        task_id = resp.task_id
    except ValidationError as e:
        pprint(f"failed to validate the task parameters, {task_id}, error: {e}")
        return
    except BlueskyRemoteError as e:
        pprint(f"server error with this message: {e}")
        return
    except ValueError:
        pprint("task could not run")
        return
        
        ```
        
        arguably this exists therefore we can close this PR

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.

Unclear error message when plan does not exists
3 participants