Added new function to create an error without throwing it