Skip to content

Commit

Permalink
Throw the error
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Nov 28, 2016
1 parent f85043c commit 4c360f9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
10 changes: 6 additions & 4 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

// Add your own contribution below

* Improved error messaging around not including a `DANGER_GITHUB_API_TOKEN` in the ENV - nsfmc / orta

### 0.6.3

* Does not break commonmark on GitHub - orta
* upgrades to flow 0.35.0 and fixes associated type errors in covariant/invariant interfaces
* omits flow requirement for new test files
* adds support for circleci
* defines CISource properties in flow as read-only
* upgrades to flow 0.35.0 and fixes associated type errors in covariant/invariant interfaces - nsfmc
* omits flow requirement for new test files - nsfmc
* adds support for circleci - nsfmc
* defines CISource properties in flow as read-only - nsfmc

### 0.5.0

Expand Down
9 changes: 9 additions & 0 deletions source/platforms/_tests/platform.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// @flow

import { getPlatformForEnv } from "../platform"

it("should bail if there is no DANGER_GITHUB_API_TOKEN found", () => {
expect(() => {
getPlatformForEnv({}, {})
}).toThrow("Cannot use authenticated API requests")
})
3 changes: 2 additions & 1 deletion source/platforms/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ export function getPlatformForEnv(env: Env, source: CISource): ?Platform {
if (!token) {
console.error("The DANGER_GITHUB_API_TOKEN environmental variable is missing")
console.error("Without an api token, danger will be unable to comment on a PR")
throw new Error("Cannot use authenticated API requests.")
}

const github = new GitHub(token, source)
return github
}

0 comments on commit 4c360f9

Please sign in to comment.