Skip to content

fix: throw better error on getPath('logs') - #19545

Merged
codebytere merged 1 commit into
6-0-xfrom
throw-better-logs-error-6
Jul 31, 2019
Merged

codebytere merged 1 commit into
6-0-xfrom
throw-better-logs-error-6

Conversation

@codebytere

Copy link
Copy Markdown
Member

Backport of .#19514.

See that PR for more details.

Notes: getPath('logs') now throws better error when it fails to find the logs path.

@codebytere codebytere added backport This is a backport PR 6-0-x labels Jul 31, 2019
@trop trop Bot mentioned this pull request Jul 31, 2019
5 tasks done
@codebytere
codebytere requested a review from a team July 31, 2019 15:20

@MarshallOfSound MarshallOfSound left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We discussed this a bit in slack with @ckerr but instead of throwing an error where the get fails for logs, can we just set it to the default then return it again?

@ckerr

ckerr commented Jul 31, 2019

Copy link
Copy Markdown
Member

I'm of two minds about this:

  1. apps that relied on getPath('log') to work before will now get an exception, which is not great API.

  2. adding side-effects to an accessor, e.g. creating a directory as a side-effect of getPath('log'), is not great API.

Maybe we could keep the side-effect for 6 to keep apps from breaking in the short term, but deprecate the behavior and require users of 7 (or 8, if we're being strict on the deprecation protocol) to call app.setAppLogsPath() before using app.getPath('log')?

@MarshallOfSound

Copy link
Copy Markdown
Member

adding side-effects to an accessor, e.g. creating a directory as a side-effect of getPath('log'), is not great API.

As an opposite take, an API returning a file path that doesn't exist isn't great either 🤷‍♂

@MarshallOfSound
MarshallOfSound dismissed their stale review July 31, 2019 22:46

the requested changes will land to master in a follow up, this is just a backport of an already landed PR

@codebytere
codebytere merged commit fa4a26a into 6-0-x Jul 31, 2019
@release-clerk

release-clerk Bot commented Jul 31, 2019

Copy link
Copy Markdown

Release Notes Persisted

getPath('logs') now throws better error when it fails to find the logs path.

@codebytere
codebytere deleted the throw-better-logs-error-6 branch July 31, 2019 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6-0-x backport This is a backport PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants