Skip to content

Commit

Permalink
Expose more info with unknown exception (apache#9323)
Browse files Browse the repository at this point in the history
* Expose more info with unknown exception

Signed-off-by: Renkai <[email protected]>

* polish

Signed-off-by: Renkai <[email protected]>

* polish

Signed-off-by: Renkai <[email protected]>

* drop {} to enable detail exception

Signed-off-by: Renkai <[email protected]>
  • Loading branch information
Renkai authored Jan 29, 2021
1 parent de43bc3 commit 4896192
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

@InterfaceAudience.LimitedPrivate
@InterfaceStability.Stable
@SuppressWarnings({"serial", "checkstyle:javadoctype"})
@SuppressWarnings({ "serial", "checkstyle:javadoctype" })
public class ManagedLedgerException extends Exception {
public ManagedLedgerException(String msg) {
super(msg);
Expand All @@ -33,6 +33,10 @@ public ManagedLedgerException(Throwable e) {
super(e);
}

public ManagedLedgerException(String msg, Throwable e) {
super(msg, e);
}

public static ManagedLedgerException getManagedLedgerException(Throwable e) {
if (e instanceof ManagedLedgerException) {
return (ManagedLedgerException) e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3436,7 +3436,7 @@ public static ManagedLedgerException createManagedLedgerException(Throwable t) {
return createManagedLedgerException(t.getCause());
} else {
log.error("Unknown exception for ManagedLedgerException.", t);
return new ManagedLedgerException("Unknown exception");
return new ManagedLedgerException("Other exception", t);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
package org.apache.bookkeeper.mledger.impl;

import static org.apache.bookkeeper.mledger.util.SafeRun.safeRun;

import com.google.common.collect.Lists;
import io.netty.util.Recycler;
import io.netty.util.Recycler.Handle;
import java.util.List;

import org.apache.bookkeeper.mledger.AsyncCallbacks.ReadEntriesCallback;
import org.apache.bookkeeper.mledger.Entry;
import org.apache.bookkeeper.mledger.ManagedLedgerException;
Expand Down Expand Up @@ -115,8 +113,8 @@ public void readEntriesFailed(ManagedLedgerException exception, Object ctx) {
checkReadCompletion();
} else {
if (!(exception instanceof TooManyRequestsException)) {
log.warn("[{}][{}] read failed from ledger at position:{} : {}", cursor.ledger.getName(),
cursor.getName(), readPosition, exception.getMessage());
log.warn("[{}][{}] read failed from ledger at position:{}", cursor.ledger.getName(),
cursor.getName(), readPosition, exception);
} else {
if (log.isDebugEnabled()) {
log.debug("[{}][{}] read throttled failed from ledger at position:{}", cursor.ledger.getName(),
Expand Down

0 comments on commit 4896192

Please sign in to comment.