Skip to content

Commit

Permalink
fix(debug): Adds class name to ProviderException for more detailed er…
Browse files Browse the repository at this point in the history
…ror logging. (#174)
  • Loading branch information
Travis Tomsu authored Apr 25, 2017
1 parent e5d9630 commit 5bd3d74
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public Set<R> getAll() throws ProviderException {
try {
return ImmutableSet.copyOf(cache.get(CACHE_KEY, this::loadAll));
} catch (ExecutionException | UncheckedExecutionException e) {
throw new ProviderException(e.getCause());
throw new ProviderException(this.getClass(), e.getCause());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,15 @@

public class ProviderException extends RuntimeException {

public ProviderException() {
}

public ProviderException(String message) {
super(message);
}

public ProviderException(String message, Throwable cause) {
super(message, cause);
}
private Class provider;

public ProviderException(Throwable cause) {
public ProviderException(Class provider, Throwable cause) {
super(cause);
this.provider = provider;
}

public ProviderException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
@Override
public String getMessage() {
return "(Provider: " + provider.getSimpleName() + ") " + super.getMessage();
}
}

0 comments on commit 5bd3d74

Please sign in to comment.