I am running a query to return some data
async function getIngress(namespace) {
try {
const result = await k8sIngressApi.listNamespacedIngress(namespace, true);
const resultSpec = result.body.items[0].spec;
return resultSpec;
} catch (e) {
throw new Error(e);
}
}
How do I check if resultSpec
is undefined
and if so throw and error and stop executing?
I have tried
return resultSpec || throw new Error()
however get syntax errors when I try that.