Custom Error
mastilver opened this issue · 2 comments
mastilver commented
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 ;)
andywer commented
Sure :) How about LeakError
?
Btw: What's the use case for deciding if it is a memory leak error or something else?