Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

try catch

async function promHandler<T>(
  prom: Promise<T>
): Promise<[T | null, any]> {
  try {
    return [await prom, null];
  } catch (error) {
    return [null, error];
  }
}
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #catch
ADD COMMENT
Topic
Name
6+7 =