See extended description

1. Replaced raise_error() calls with throw_exception()
2. Corrected typos in error messages