Handel classify text error

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: [] })

--

--

I am a Back-End Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store