Adding error management.

If there's an error on the request the response is null. Added errors management.