Fixes submit on error

Fixes issue #40. When the validation callback throws an error, the calling function breaks before calling `event.preventDefault()` but catches and suppresses the error in the `onSubmit` handler making the form submit for seemingly no reason. This pull request moves the `try...catch` so that an invalid form will not submit when the callback throws an error.