logic when throwing error changed