Added some checks for custom erros being set.