Skip to content

Commit

Permalink
fix: warn user if api key is wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarnadas committed Feb 13, 2019
1 parent 5839d4c commit 26f45b4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ node_js:
env:
global:
- CXX=g++-4.8
- PACKAGE_VERSION="2.2.1"
- PACKAGE_VERSION="2.2.2"

addons:
apt:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "net64plus-server",
"version": "2.2.1",
"version": "2.2.2",
"compatVersion": "1.0",
"description": "Net64+ Dedicated Server",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/WebHook.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ describe('WebHook', () => {
})
await new Promise((resolve) => setTimeout(resolve(), 0))

expect(console.error).toHaveBeenCalledWith('Your API key seems to be wrong. Please check your settings!\nWebHook was disabled now')
expect(console.error).toHaveBeenCalledWith('Your API key seems to be wrong. Please check your settings!\nYour server won\'t be publicly visible')
})
})
5 changes: 3 additions & 2 deletions src/WebHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ export class WebHook {
)).data
this.id = res.id
} catch (err) {
if (err.response && err.response.status === 401) {
console.error('Your API key seems to be wrong. Please check your settings!\nWebHook was disabled now')
if (err.response && err.response.status === 400) {
console.warn('WARNING: Your API key seems to be wrong. Please check your settings!\nYour server won\'t be publicly visible')
return
} else {
// fail silently. Server might be unreachable
}
Expand Down

0 comments on commit 26f45b4

Please sign in to comment.