As a beginner, I am learning how to write a try/catch statement in TypeScript. My issue is that there is a function within the "try" block that returns null. How can I implement code in the "catch" block specifically for when the function in "try" returns null? Here is an example:
try {
const availableimg = await imgpath({filename, width, height});
res.send(`${availableimg}`);
} catch {
// I want this code to execute here if the imgpath function returned null!
}
I apologize if there are any errors in my understanding. Thank you for your assistance.