Add dynamic errors and error handling