Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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+2 =