Skip to content

Commit

Permalink
Improve message for missing ext. reference (#55)
Browse files Browse the repository at this point in the history
Add fixing proposal to avoid the problem with missing ext. reference.
  • Loading branch information
michelu89 authored Dec 5, 2023
1 parent 594cfca commit f05a609
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ private Try<Model> tryOnFailure( final AspectModelUrn aspectModelUrn ) {
return Try.success( currentAspectModel );
}

return Try.failure( new UrnNotFoundException( String.format( "%s cannot be resolved correctly.", aspectModelUrn ),
aspectModelUrn ) );
return Try.failure( new UrnNotFoundException( String.format(
"The model failed to load because the reference '%s' in the same namespace was unresolved.",
aspectModelUrn ), aspectModelUrn ) );
}

protected abstract Try<Model> getModelFromFileSystem( AspectModelUrn aspectModelUrn, Path rootPath );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ public ViolationError visitProcessingViolation( final ProcessingViolation violat

if ( violation.cause() instanceof UrnNotFoundException urnNotFoundException ) {
violationError.setFocusNode( urnNotFoundException.getUrn() );
violationError.setFix( List.of(
"Ensure the referred element is available. If it's in a different model of the same namespace, include it in your workspace or the imported package." ) );
}

return violationError;
Expand Down

0 comments on commit f05a609

Please sign in to comment.