fix undefined gravity

- wrap everything in try catch so that Node doesn't blow up
- define throw macro