Skip to content

Commit

Permalink
Improve boostrap log to expose the wrong classLoader (#24533)
Browse files Browse the repository at this point in the history
Summary:

Improve bootstrap error message for incorrect classloader to include what classloader was found.

Differential Revision: D69416153
  • Loading branch information
ericyuliu authored and rschlussel committed Feb 18, 2025
1 parent db0fe87 commit d7c0930
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ private Bootstrap()
public static CallSite bootstrap(MethodHandles.Lookup callerLookup, String name, MethodType type, long bindingId)
{
ClassLoader classLoader = callerLookup.lookupClass().getClassLoader();
checkArgument(classLoader instanceof DynamicClassLoader, "Expected %s's classloader to be of type %s", callerLookup.lookupClass().getName(), DynamicClassLoader.class.getName());

checkArgument(
classLoader instanceof DynamicClassLoader,
"Expected %s's classloader to be of type %s, but is %s",
callerLookup.lookupClass().getName(),
DynamicClassLoader.class.getName(),
classLoader.getClass().getName());
DynamicClassLoader dynamicClassLoader = (DynamicClassLoader) classLoader;
MethodHandle target = dynamicClassLoader.getCallSiteBindings().get(bindingId);
checkArgument(target != null, "Binding %s for function %s%s not found", bindingId, name, type.parameterList());
Expand Down

0 comments on commit d7c0930

Please sign in to comment.