Skip to content

Commit 3538ed8

Browse files
author
Botium
authored
Merge pull request #29 from codeforequity-at/bugfix/BOT-819-connector-directline-fails-and-b
bugfix/BOT-819-connector-directline-fails-and-b
2 parents 84178ad + 883e249 commit 3538ed8

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

index.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const util = require('util')
21
const uuidv4 = require('uuid/v4')
32
const mime = require('mime-types')
43
const _ = require('lodash')
@@ -318,17 +317,17 @@ class BotiumConnectorDirectline3 {
318317
'Content-Type': 'multipart/form-data'
319318
},
320319
body: formData
321-
}).catch(err => {
322-
debug('Error posting activity with attachments', err)
323-
reject(new Error(`Error posting activity: ${err}`))
324320
}).then(async (res) => {
325321
const json = await res.json()
326-
if (json.id) {
322+
if (json && json.id) {
327323
debug('Posted activity with attachments, assigned ID:', json.id)
328324
resolve()
329325
} else {
330-
reject(new Error(`Error posting activity with attachments: ${util.inspect(json)}`))
326+
reject(new Error('Error posting activity with attachments, no activity id returned'))
331327
}
328+
}).catch(err => {
329+
debug('Error posting activity with attachments', err)
330+
reject(new Error(`Error posting activity: ${err.message}`))
332331
})
333332
} else {
334333
debug('Posting activity ', JSON.stringify(activity, null, 2))

0 commit comments

Comments
 (0)