Change error string to error object.