Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

Setup guards for config options #86

Closed
wants to merge 3 commits into from
Closed

Setup guards for config options #86

wants to merge 3 commits into from

Conversation

tcbyrd
Copy link
Contributor

@tcbyrd tcbyrd commented Jan 11, 2018

Closes #81

I wasn't sure what the most optimal way to do this was, but here's what I came up with. If we check the config in the constructor and throw the appropriate errors, it won't attempt any further action on the offending repository until the next scheduled markAndSweep. We still need a way to report this error to the user, but this at least handles the error more gracefully and lets us know the problem was caused by an invalid configuration.

Here is an example error message:

00:12:05.784Z ERROR probot: daysUntilClose must be between 1 and 10000: (daysUntilClose=10005)
  RangeError: daysUntilClose must be between 1 and 10000: (daysUntilClose=10005)
      at checkConfig (/Users/tcbyrd/probot/stale/lib/stale.js:10:13)
      at new Stale (/Users/tcbyrd/probot/stale/lib/stale.js:30:5)
      at forRepository (/Users/tcbyrd/probot/stale/index.js:57:12)
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:160:7)
  --
  event: {
    "event": "schedule.repository",
    "repository": "tcbyrd/testrepo",
    "installation": 32078
  }

If defined during the constructor, throwing errors prevents any further
action on that repo until the next scheduled markAndSweep.
@tcbyrd tcbyrd self-assigned this Jan 11, 2018
@tcbyrd tcbyrd requested a review from bkeepers January 11, 2018 00:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant