File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 1- const util = require ( 'util' )
21const uuidv4 = require ( 'uuid/v4' )
32const mime = require ( 'mime-types' )
43const _ = 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 ) )
You can’t perform that action at this time.
0 commit comments