📜  try catch - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:36.890000             🧑  作者: Mango

代码示例6
async function promHandler(
  prom: Promise
): Promise<[T | null, any]> {
  try {
    return [await prom, null];
  } catch (error) {
    return [null, error];
  }
}