/**
 * 用于获取await结果和错误
 * const res = await awaitCatch(getList())
 * @param fn
 * @return {Promise<*[]|*[]>}
 */

export default async function awaitCatch (fn) {
  try {
    const res = await fn
    return [res, null]
  } catch (err) {
    return [null, err]
  }
}
