@@ -392,6 +392,7 @@ class ChatwootClient {
392392 return data . payload . find ( x => ( x . phone_number || "" ) . includes ( n ) ) || false
393393 } else false
394394 } catch ( error ) {
395+ log . error ( `CW SEARCH CONTACT ERROR: ${ error . message } ` )
395396 return ;
396397 }
397398 }
@@ -409,6 +410,7 @@ class ChatwootClient {
409410 }
410411 return resolvedConversation ;
411412 } catch ( error ) {
413+ log . error ( `CW GET CONVERSATION ERROR: ${ error . message } ` )
412414 return ;
413415 }
414416 }
@@ -421,6 +423,7 @@ class ChatwootClient {
421423 } ) ;
422424 return data ;
423425 } catch ( error ) {
426+ log . error ( `CW CREATE CONVERSATION ERROR: ${ error . message } ` )
424427 return ;
425428 }
426429 }
@@ -439,6 +442,7 @@ class ChatwootClient {
439442 } )
440443 return data . payload . contact
441444 } catch ( error ) {
445+ log . error ( `CW CREATE CONTACT ERROR: ${ error . message } ` )
442446 return ;
443447 }
444448 }
@@ -450,6 +454,7 @@ class ChatwootClient {
450454 } ) ;
451455 return data ;
452456 } catch ( error ) {
457+ log . error ( `CW OPEN CONVERSATION ERROR: ${ error . message } ` )
453458 return ;
454459 }
455460 }
@@ -467,6 +472,7 @@ class ChatwootClient {
467472 } ) ;
468473 return data ;
469474 } catch ( error ) {
475+ log . error ( `CW SEND CONVERSATION MESSAGE ERROR: ${ error . message } ` )
470476 return ;
471477 }
472478 }
@@ -486,6 +492,7 @@ class ChatwootClient {
486492 const { data } = await this . cwReq ( 'post' , `conversations/${ convoReg [ contactId ] } /messages` , formData , formData . getHeaders ( ) ) ;
487493 return data ;
488494 } catch ( error ) {
495+ log . error ( `CW SEND ATTACHMENT MESSAGE ERROR: ${ error . message } ` )
489496 return ;
490497 }
491498 }
@@ -520,6 +527,9 @@ class ChatwootClient {
520527 convoReg [ message . chatId ] = conversation . id
521528 } else {
522529 //create the conversation
530+ /**
531+ * TODO: Handle create conversation error
532+ */
523533 convoReg [ message . chatId ] = ( await this . createConversation ( contactReg [ message . chatId ] ) ) . id
524534 isNewConversation = convoReg [ message . chatId ]
525535 }
0 commit comments