Errors

- Added error handling for std::bad_alloc.