Skip to content

Commit 5e2bb7e

Browse files
committed
throw error on no config, bind verifyrequest
1 parent fd08d17 commit 5e2bb7e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/bot.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export default class LineBot extends EventEmitter {
2424

2525
constructor ({secret, token, options = {}}) {
2626
super()
27+
if (!secret) throw new Error('Please supply a LINE Secret.')
28+
if (!token) throw new Error('Please supply a LINE Token.')
2729
this.secret = secret
2830
this.token = token
2931
this.options = options
@@ -59,7 +61,7 @@ export default class LineBot extends EventEmitter {
5961
data: payload || {}
6062
}
6163
if (type === 'content') opts.responseType = 'arraybuffer'
62-
return axios(opts).catch(err => err.response)
64+
return axios(opts).catch(err => Promise.reject(err.response))
6365
}
6466

6567
processEvents (events, req) {

src/webhook.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class Webhook {
1818

1919
this._parseBody = this._parseBody.bind(this)
2020
this._getSignature = this._getSignature.bind(this)
21+
this._verifyRequest = this._verifyRequest.bind(this)
2122
this._createTunnel = this._createTunnel.bind(this)
2223

2324
const app = express()

0 commit comments

Comments
 (0)