📜  try catch - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:55.594000             🧑  作者: Mango

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