Add back removed error handling logic