Skip to content

Commit

Permalink
Print error log and trace when provider init failed.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhi1ong committed Jan 4, 2021
1 parent d60c654 commit 5829604
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private static void register(String className) {
+ " should implements one of IRouteRoot/IProviderGroup/IInterceptorGroup.");
}
} catch (Exception e) {
logger.error(TAG,"register class error:" + className);
logger.error(TAG,"register class error:" + className, e);
}
}
}
Expand Down Expand Up @@ -287,7 +287,8 @@ public synchronized static void completion(Postcard postcard) {
Warehouse.providers.put(providerMeta, provider);
instance = provider;
} catch (Exception e) {
throw new HandlerException("Init provider failed! " + e.getMessage());
logger.error(TAG, "Init provider failed!", e);
throw new HandlerException("Init provider failed!");
}
}
postcard.setProvider(instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public interface ILogger {

void error(String tag, String message);

void error(String tag, String message, Throwable e);

void monitor(String message);

boolean isMonitorMode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ boolean addRouteGroup(IRouteGroup group) {

return true;
} catch (Exception exception) {
logger.error(Consts.TAG, "Add route group dynamic exception! " + exception.getMessage());
logger.error(Consts.TAG, "Add route group dynamic exception!", exception);
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ public void error(String tag, String message) {
}
}

@Override
public void error(String tag, String message, Throwable e) {
if (isShowLog) {
Log.e(TextUtils.isEmpty(tag) ? getDefaultTag() : tag, message, e);
}
}


@Override
public void monitor(String message) {
if (isShowLog && isMonitorMode()) {
Expand Down

0 comments on commit 5829604

Please sign in to comment.