@Override public Promise<T> fail(Effect<Throwable> e) { return delegate.fail(e); }
@Override public void apply(A v) { try { @SuppressWarnings("unchecked") Promise<B> next = (Promise<B>) f.apply(v); next.done(new Effect<B>() { @Override public void apply(B t) { result.set(t); } }).fail(failResult); } catch (Throwable t) { result.setException(t); } } }).fail(failResult);
@Override protected void doStart() { long delayMilliseconds = 0; attemptCount++; hipChatTasksExecutor.schedule(synchoniser, delayMilliseconds, TimeUnit.MILLISECONDS) .fail(new Effect<Throwable>() { @Override public void apply(final Throwable throwable) { logger.warn("Failed to schedule task to upgrade capabilities."); } }); }
@Override public Promise<A> fail(Effect<Throwable> e) { delegate().fail(e); return this; }
private void handleTransientError(final ResourceError resourceError) { long delayMilliseconds = retryPolicy.getDelayMilliseconds(resourceError); if (delayMilliseconds >= 0) { logger.warn("Unable to upgrade capabilities - will retry after {} milliseconds...", delayMilliseconds); attemptCount++; hipChatTasksExecutor.schedule(synchoniser, delayMilliseconds, TimeUnit.MILLISECONDS) .fail(new Effect<Throwable>() { @Override public void apply(final Throwable throwable) { logger.warn("Failed to reschedule task to upgrade capabilities."); } }); } else { logger.warn("Unable to upgrade capabilities - giving up following {} attempts.", attemptCount); } }
private void safelyRemoveTemporaryAttachmentFromStore(final TemporaryWebAttachment temporaryWebAttachment) { attachmentStore.deleteTemporaryAttachment(temporaryWebAttachment.getTemporaryAttachmentId()).fail(new Effect<Throwable>() { @Override public void apply(final Throwable throwable) { ExceptionUtil.logExceptionWithWarn(log, "Got exception while removing temporary attachment.", throwable); } }); }
@Override public <B> Promise<B> fold(final Function<Throwable, ? extends B> ft, final Function<? super A, ? extends B> fa) { final SettableFuture<B> result = SettableFuture.create(); final Effect<Throwable> error = new Effect<Throwable>() { @Override public void apply(Throwable t) { try { result.set(ft.apply(t)); } catch (Throwable inner) { result.setException(inner); } } }; done(new Effect<A>() { public void apply(A a) { try { result.set(fa.apply(a)); } catch (Throwable t) { error.apply(t); } } }).fail(error); return new Of<B>(result); } }
.fail(new Effect<Throwable>() { @Override public void apply(final Throwable throwable) {
@Override public Void get(final Pair<Attachment, AttachmentKey> input) { final Promise<Attachment> op = attachmentStore.putAttachment(input.left(), source.getAttachmentFile(input.right())) .fail(new Effect<Throwable>() { @Override public void apply(final Throwable throwable) { abortCause.set(Option.some(throwable)); } }); onCompleteAttachment.foreach(new com.atlassian.fugue.Effect<Effect<Attachment>>() { @Override public void apply(final Effect<Attachment> attachmentEffect) { op.done(attachmentEffect); } }); return null; } }, ExceptionPolicy.Policies.THROW);
@Override public Void call() throws Exception { if (!isCancelled()) { try { final Option<HipChatLink> defaultLinkOption = hipChatLinkProvider.getDefaultLink(); if (defaultLinkOption.isEmpty()) { logger.debug("The link has been deleted since the time the upgrader was scheduled."); } else { final HipChatLink hipChatLink = defaultLinkOption.get(); HipChatAPI<HipChatAPI.TokenType.AddonToken> hipChatAPI = hipChatLink.getAddonApi(); hipChatDescriptorUpdateService.updateConnectDescriptor(hipChatAPI, newConnectDescriptor) .done(new Effect<Result<Void>>() { @Override public void apply(final Result<Void> result) { handleDone(result, hipChatLink); } }) .fail(failureHandler); } } catch (final Exception e) { handleInternalError(e); } } return null; }
.fail(new Effect<Throwable>() { @Override public void apply(final Throwable throwable) {