/** Configures this sound with an error in lieu of its platform implementation. * This may be called from any thread. */ public synchronized void fail (Throwable error) { ((RPromise<Sound>)state).fail(error); }
/** Configures this sound with an error in lieu of its platform implementation. * This may be called from any thread. */ public synchronized void fail (Throwable error) { ((RPromise<Sound>)state).fail(error); }
public void onEmit (Throwable cause) { fail(cause); } };
public void onEmit (Throwable cause) { fail(cause); } };
private void superFail (Throwable cause) { super.fail(cause); } };
private void superFail (Throwable cause) { super.fail(cause); } };
@Override public void didFail(NSURLConnection conn, NSError error) { String errmsg = error.getLocalizedDescription(); result.fail(rspCode > 0 ? new HttpException(rspCode, errmsg) : new Exception(errmsg)); }
public void onEmit (ByteBuffer buf) { try { LibraryData libData = new LibraryData(buf); decodeLibraryAsync(plat, libData, baseDir, result); } catch (Exception err) { result.fail(err); } } });
public void run () { try { result.succeed(getBytesSync(path)); } catch (Throwable t) { result.fail(t); } } });
/** Notifies this image that its implementation bitmap failed to load. * This can be called from any thread. */ public synchronized void fail (Throwable error) { if (pixelWidth == 0) pixelWidth = 50; if (pixelHeight == 0) pixelHeight = 50; setBitmap(createErrorBitmap(pixelWidth, pixelHeight)); ((RPromise<Image>)state).fail(error); // state is a deferred promise }
public void run () { try { result.succeed(getTextSync(path)); } catch (Throwable t) { result.fail(t); } } });
/** Notifies this image that its implementation bitmap failed to load. * This can be called from any thread. */ public synchronized void fail (Throwable error) { if (pixelWidth == 0) pixelWidth = 50; if (pixelHeight == 0) pixelHeight = 50; setBitmap(createErrorBitmap(pixelWidth, pixelHeight)); ((RPromise<Image>)state).fail(error); // state is a deferred promise }
public void run () { try { result.succeed(getTextSync(path)); } catch (Throwable t) { result.fail(t); } } });
public void run () { try { result.succeed(getBytesSync(path)); } catch (Throwable t) { result.fail(t); } } });
@Override public void onError(XDomainRequest xdr) { plat.log().error("xdr::onError[" + path + "]()"); result.fail(new Exception("Error getting " + path + " : " + xdr.getStatus())); } });
@Override public void onError(XDomainRequest xdr) { plat.log().error("xdr::onError[" + path + "]()"); result.fail(new Exception("Error getting " + path + " : " + xdr.getStatus())); } });
@Override public void onTimeout(XDomainRequest xdr) { plat.log().error("xdr::onTimeout[" + path + "]()"); result.fail(new Exception("Error getting " + path + " : " + xdr.getStatus())); }
@Override public void onTimeout(XDomainRequest xdr) { plat.log().error("xdr::onTimeout[" + path + "]()"); result.fail(new Exception("Error getting " + path + " : " + xdr.getStatus())); }
@Override public void onReadyStateChange(XMLHttpRequest xhr) { int readyState = xhr.getReadyState(); if (readyState == XMLHttpRequest.DONE) { int status = xhr.getStatus(); // status code 0 will be returned for non-http requests, e.g. file:// if (status != 0 && (status < 200 || status >= 400)) { plat.log().error("xhr::onReadyStateChange[" + path + "]" + "(readyState = " + readyState + "; status = " + status + ")"); result.fail(new Exception("Error getting " + path + " : " + xhr.getStatusText())); } else { if (LOG_XHR_SUCCESS) plat.log().debug("xhr::onReadyStateChange[" + path + "]" + "(readyState = " + readyState + "; status = " + status + ")"); result.succeed(xhr); } } } });
@Override public void onReadyStateChange(XMLHttpRequest xhr) { int readyState = xhr.getReadyState(); if (readyState == XMLHttpRequest.DONE) { int status = xhr.getStatus(); // status code 0 will be returned for non-http requests, e.g. file:// if (status != 0 && (status < 200 || status >= 400)) { plat.log().error("xhr::onReadyStateChange[" + path + "]" + "(readyState = " + readyState + "; status = " + status + ")"); result.fail(new Exception("Error getting " + path + " : " + xhr.getStatusText())); } else { if (LOG_XHR_SUCCESS) plat.log().debug("xhr::onReadyStateChange[" + path + "]" + "(readyState = " + readyState + "; status = " + status + ")"); result.succeed(xhr); } } } });