andywer/leakage

Custom Error

mastilver opened this issue · 2 comments

this https://github.com/andywer/leakage/blob/master/lib/leakErrorFactory.js#L26 should use a custom error

The custom Error should be exported as well so we can do that:

import { iterate, LeakageError } from 'leakage';

try {
  iterate(100, () => {
    throw new Error('random error')
  })
} catch (err) {
  if (err instanceof LeakageError) {
    // leaked detected
  }

  // something else happened
}

I use LeakageError but we need to find a better name ;)

Sure :) How about LeakError?

Btw: What's the use case for deciding if it is a memory leak error or something else?

@andywer Thank you so much for looking into that

Sorry I wasn't much active on the Promise /async work, you did some awesome work there!! 👍