Got stuck in a bug where the error is not returning in the response body, although that the console.log()
shows the error in the terminal.
the function
const Attributes = async () => {
try {
const response = await CISP.adminGetUser(IdentityParams).promise();
UserAttributesInfoData = response
} catch (err) {
console.error(err)
}
return UserAttributesInfoData;
};
await Attributes().then((data) => UserAttributesInfoData = data);
response code
response = {
statusCode: 200,
body: JSON.stringify({
message: 'IVS - CreateChannel',
// location: ret.data.trim()
}),
};
} catch (err) {
console.log(err);
return err;
}
return response;
The code works very well, but what I’m trying to do is to catch the errors in the response body.
So far, when I modify a parameter in purpose to see if the response catches the error, it returns empty.
How can I do it to return the error in the response?