Handel classify text error
May 11, 2022
--
console.log('starting classify...')
//let classification = await client.classifyText({ document });
/**
* handel classify error start
*/
let classification : any;
const operation = new Promise<any>((resolve, reject) => {
client.classifyText({ document }).then(
(onResolved) => {
resolve(onResolved);
},
(onRejected) => {
reject(onRejected);
})
});
try{
classification = await operation;
}catch (e) {
console.log('classification error:::', e)
}
/**
* handel classify error end
*/
console.log('classification done')
console.log(classification)
if(!!classification) /** handel null value **/
processResult = Object.assign(storeMailObject, classification[0])
else
processResult = Object.assign(storeMailObject, { categories: [] })