No need to parseint the error object
Moved parsing of error objects to its own function