How to handle AsyncTask failure
<p>Is there a specific way to handle failure in an AsyncTask? As far as I can tell the only way is with the return value of task. I'd like to be able to provide more details on the failure if possible, and null isn't very verbose.</p>

<p>Ideally it would provide an onError handler, but I don't think it has one.</p>

<pre><code>class DownloadAsyncTask extends AsyncTask&lt;String, Void, String&gt; {

    /** this would be cool if it existed */
    @Override
    protected void onError(Exception ex) {
        ...
    }

    @Override
    protected String doInBackground(String... params) {
    try {
            ... download ...
        } catch (IOException e) {
            setError(e); // maybe like this?
        }
    }       
}
</code></pre>
