Changed how errors are handled by delegate.

Using NSError is more appropreate way to handle errors.