Skip to content

Fix crash caused by unreachable SAL server by adding more SAL options#42

Open
skuba31 wants to merge 1 commit intocherab:developmentfrom
skuba31:feature-more-sal
Open

Fix crash caused by unreachable SAL server by adding more SAL options#42
skuba31 wants to merge 1 commit intocherab:developmentfrom
skuba31:feature-more-sal

Conversation

@skuba31
Copy link

@skuba31 skuba31 commented Feb 5, 2026

Fixes crash when importing cherab.jet while SAL server is unreachable #40

Adds new subclass and function that check sal reachability only on instantiation or call so that the import of package is unaffectd.

Also adds a custom getattr method of cherab.jet.sal module that allows to use former notation from cherab.jet.sal import sal. Usage of this notation is discouraged as it results in the connection error being raised if SAL server is not reachable on import.

Comment on lines +15 to +22
def get_jet_sal(host: str = SAL_SERVER, **kwargs) -> SALClient:
"""Creates a SALClient instance connected to `host` if provided.
By default uses env variable `JET_SAL_SERVER` if set, `https://sal.jetdata.eu` otherwise.
"""
return SALClient(host=host, **kwargs)


def __getattr__(name: str):
Copy link
Member

Choose a reason for hiding this comment

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

Unless Github's formatting is off, I think you're missing some indentation here: these functions should be class methods.

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.

2 participants