@Override public void prerequisiteFailed(final Collection<? extends Prerequisite<?>> failed) { if (failed.contains(imported)) { throw new InferenceException(stmt.getStatementSourceReference(), "Imported module [%s] was not found.", moduleName); } } });
@Override public void prerequisiteFailed(final Collection<? extends Prerequisite<?>> failed) { if (failed.contains(imported)) { throw new InferenceException(stmt.getStatementSourceReference(), "Unable to find module compatible with requested import [%s(%s)].", moduleName, getRequestedImportVersionString(stmt)); } } });
@Override public void prerequisiteFailed(final Collection<? extends Prerequisite<?>> failed) { if (failed.contains(belongsToPrereq)) { throw new InferenceException(belongsToCtx.getStatementSourceReference(), "Module '%s' from belongs-to was not found", belongsToCtx.getStatementArgument()); } } });
@Override public void prerequisiteFailed(final Collection<? extends Prerequisite<?>> failed) { throw new InferenceException(deviateStmtCtx.coerceParentContext().getStatementSourceReference(), "Deviation target '%s' not found.", deviationTarget); } });
Optional<SourceException> failModifiers(final ModelProcessingPhase identifier) { final List<SourceException> exceptions = new ArrayList<>(); for (final ModifierImpl mod : modifiers.get(identifier)) { try { mod.failModifier(); } catch (final SourceException e) { exceptions.add(e); } } if (exceptions.isEmpty()) { return Optional.empty(); } final String message = String.format("Yang model processing phase %s failed", identifier); final InferenceException e = new InferenceException(message, root.getStatementSourceReference(), exceptions.get(0)); exceptions.listIterator(1).forEachRemaining(e::addSuppressed); return Optional.of(e); }
@Override public void prerequisiteFailed(final Collection<? extends Prerequisite<?>> failed) { InferenceException.throwIf(failed.contains(sourceGroupingPre), usesNode.getStatementSourceReference(), "Grouping '%s' was not resolved.", groupingName); throw new InferenceException("Unknown error occurred.", usesNode.getStatementSourceReference()); } });
/** * Throw an instance of this exception if an expression evaluates to true. If the expression evaluates to false, * this method does nothing. * * @param expression Expression to be evaluated * @param source Statement source reference * @param format Format string, according to {@link String#format(String, Object...)}. * @param args Format string arguments, according to {@link String#format(String, Object...)} * @throws InferenceException if the expression evaluates to true. */ public static void throwIf(final boolean expression, final @NonNull StatementSourceReference source, final @NonNull String format, final Object... args) { if (expression) { throw new InferenceException(source, format, args); } } }
@Override public void prerequisiteFailed(final Collection<? extends Prerequisite<?>> failed) { throw new InferenceException(baseStmtCtx.getStatementSourceReference(), "Unable to resolve identity %s and base identity %s", baseParentCtx.getStatementArgument(), baseStmtCtx.getStatementArgument()); } });
throw new InferenceException(ctx.getStatementSourceReference(), "Key '%s' misses node '%s' in list '%s'", keyStmt.getDeclared().rawArgument(), keyQName.getLocalName(), ctx.getStatementArgument());
@Override public void prerequisiteFailed(final Collection<? extends Prerequisite<?>> failed) { /* * Do not fail, if it is an uses-augment to an unknown node. */ if (YangStmtMapping.USES == augmentNode.coerceParentContext().getPublicDefinition()) { final SchemaNodeIdentifier augmentArg = augmentNode.coerceStatementArgument(); final Optional<StmtContext<?, ?, ?>> targetNode = ChildSchemaNodeNamespace.findNode( getSearchRoot(augmentNode), augmentArg); if (targetNode.isPresent() && StmtContextUtils.isUnknownStatement(targetNode.get())) { augmentNode.setIsSupportedToBuildEffective(false); LOG.warn("Uses-augment to unknown node {}. Augmentation has not been performed. At line: {}", augmentArg, augmentNode.getStatementSourceReference()); return; } } throw new InferenceException(augmentNode.getStatementSourceReference(), "Augment target '%s' not found", augmentNode.getStatementArgument()); } });
throw new InferenceException(ctx.getStatementSourceReference(), "Cannot resolve QNameModule for '%s'", str);
@Override public void onFullDefinitionDeclared(final StmtContext.Mutable<SchemaNodeIdentifier, DeviationStatement, EffectiveStatement<SchemaNodeIdentifier, DeviationStatement>> ctx) { final QNameModule currentModule = ctx.getFromNamespace(ModuleCtxToModuleQName.class, ctx.getRoot()); final QNameModule targetModule = ctx.coerceStatementArgument().getLastComponent().getModule(); if (currentModule.equals(targetModule)) { throw new InferenceException(ctx.getStatementSourceReference(), "Deviation must not target the same module as the one it is defined in: %s", currentModule); } }
throw new InferenceException(stmtCtxToBeReplaced.getStatementSourceReference(), "Deviation cannot replace " + "substatement %s in target node %s because it does not exist in target node.", stmtToBeReplaced.getStatementName(), targetCtx.getStatementArgument());
throw new InferenceException(deviateStmtCtx.coerceParentContext().getStatementSourceReference(), "Deviation target '%s' not found.", deviationTarget);