Closed edemaine closed 9 months ago
Class Error exported in new release v1.4.6, you can check flatten-js errors like this:
import {Errors, vector} from "@flatten-js/core";
try {
const v = vector(0,0)
v.normalize()
}
catch (e) {
console.log(e.message === Errors.ZERO_DIVISION.message)
}
Fixed in v1.4.6
The
Errors
class is documented, but doesn't seem to be exported correctly. Instead of being a class, it's an object withdefault
property that is the class. The ESM code looks OK, so it's probably a bundling bug...Also, the
Errors
export is missing from the.d.ts
file.Context: I think
Errors
is useful for detecting that we got a division-by-zero error instead of something else.