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

Show nicer error if cachedir can't be created #88

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

Wuestengecko
Copy link
Member

If we cannot create the cache directory to install the elk.js dependencies, we used to crash with whatever error message the OS gave us. This can sometimes be misleading, e.g. when the message is talking about missing permissions, but in reality $HOME or $XDG_CACHE_HOME is simply set to a broken value.

This commit catches an OSError here and instead shows a nicer error message (and also much more concise stack trace) with a concrete hint towards $HOME.

This is mostly relevant when running inside a container or as a system service, as it's much easier to accidentally miss some envvars there.

If we cannot create the cache directory to install the elk.js
dependencies, we used to crash with whatever error message the OS gave
us. This can sometimes be misleading, e.g. when the message is talking
about missing permissions, but in reality `$HOME` or `$XDG_CACHE_HOME`
is simply set to a broken value.

This commit catches an OSError here and instead shows a nicer error
message (and also much more concise stack trace) with a concrete hint
towards `$HOME`.

This is mostly relevant when running inside a container or as a system
service, as it's much easier to accidentally miss some envvars there.
Copy link
Member

@ewuerger ewuerger left a comment

Choose a reason for hiding this comment

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

LGTM.

@ewuerger ewuerger merged commit 20887f1 into main Apr 22, 2024
10 checks passed
@ewuerger ewuerger deleted the cachedir-error-message branch April 22, 2024 12:45
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