Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #21

Merged
merged 3 commits into from
Feb 13, 2019
Merged

Dev #21

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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