Adds error handling for createTable