Skip to content

Commit

Permalink
[GR-52328] Improve an error message when a polyglot goes not support …
Browse files Browse the repository at this point in the history
…the requested sandbox policy.

PullRequest: graal/17092
  • Loading branch information
tzezula committed Feb 29, 2024
2 parents 486451e + 46dba28 commit 62ac53a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
public class SandboxPolicyTest {

private static final String MISSING_ISOLATE_LIBRARY_MESSAGE = "No native isolate library found for language";
private static final String UNSUPPORTED_ISOLATE_POLICY_MESSAGE = "the GraalVM community edition supports only sandbox policy TRUSTED or CONSTRAINED.";
private static final String UNSUPPORTED_ISOLATE_POLICY_MESSAGE = "but the current Truffle runtime only supports the TRUSTED or CONSTRAINED sandbox policies.";

private final Configuration configuration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,11 @@ private void validateSandbox(SandboxPolicy sandboxPolicy) {
// all sandboxing policies.
if (this == getRootImpl() && sandboxPolicy.isStricterThan(SandboxPolicy.CONSTRAINED)) {
throw PolyglotEngineException.illegalArgument(String.format(
"The Builder.sandbox(SandboxPolicy) is set to %s, but the GraalVM community edition supports only sandbox policy TRUSTED or CONSTRAINED." +
"In order to resolve this switch to a less strict sandbox policy using Builder.sandbox(SandboxPolicy).",
"The Builder.sandbox(SandboxPolicy) is configured to %s, but the current Truffle runtime only supports the TRUSTED or CONSTRAINED sandbox policies. " +
"This typically occurs when a non-Oracle GraalVM Java runtime is used, the org.graalvm.truffle:truffle-enterprise dependency is missing, or the fallback runtime was forced. " +
"The Truffle fallback runtime may be forced using the truffle.UseFallbackRuntime or truffle.TruffleRuntime system property. " +
"To resolve this make sure Oracle GraalVM is used, the truffle-enterprise dependency is on the class or module path and the fallback runtime is not forced. " +
"Alternatively, you can switch to a less strict sandbox policy using Builder.sandbox(SandboxPolicy).",
sandboxPolicy));
}
}
Expand Down

0 comments on commit 62ac53a

Please sign in to comment.