Check if error is a string to consider it as custom error
Remove unneeded variable