Skip to content

Commit

Permalink
Merge pull request #21 from Tarnadas/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Mario Reder committed Feb 13, 2019
2 parents 31869f8 + c840438 commit beeb9f4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 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
6 changes: 6 additions & 0 deletions changelog/2.2.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## [2.2.2](https://github.com/Tarnadas/net64plus-server/compare/2.1.2...2.2.2) (2019-02-13)


### Bug Fixes

* warn user if api key is wrong ([26f45b4](https://github.com/Tarnadas/net64plus-server/commit/26f45b4))
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
6 changes: 3 additions & 3 deletions src/WebHook.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { WebHook, URL_API } from './WebHook'
import mockAxios from 'jest-mock-axios'

beforeEach(() => {
console.error = jest.fn()
console.warn = jest.fn()
})

afterEach(() => {
Expand Down Expand Up @@ -64,11 +64,11 @@ describe('WebHook', () => {
it('should display error message on wrong apiKey', async () => {
mockAxios.mockError({
response: {
status: 401
status: 400
}
})
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.warn).toHaveBeenCalledWith('WARNING: 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 beeb9f4

Please sign in to comment.