diff --git a/java/projections-psi-parser-util/src/main/java/ws/epigraph/projections/ProjectionsParsingUtil.java b/java/projections-psi-parser-util/src/main/java/ws/epigraph/projections/ProjectionsParsingUtil.java index c166610bb..47fbb52a9 100644 --- a/java/projections-psi-parser-util/src/main/java/ws/epigraph/projections/ProjectionsParsingUtil.java +++ b/java/projections-psi-parser-util/src/main/java/ws/epigraph/projections/ProjectionsParsingUtil.java @@ -335,11 +335,7 @@ TP getTagProjection( if (targetType == null) { throw new PsiProcessingException( - String.format( - "Unknown tail type '%s'. Supported tail types: {%s}", - tailTypeRef.toString(), - String.join(", ", supportedEntityTailTypes(vp)) - ), location, ctx + unsupportedTagMsg(tailTypeRef.toString(), supportedEntityTailTypes(vp)), location, ctx ); } @@ -347,12 +343,7 @@ TP getTagProjection( if (!hasTail(vp, targetType)) { throw new PsiProcessingException( - String.format( - "Polymorphic tail for type '%s' is not supported. Supported tail types: {%s}", - targetType.name(), - String.join(", ", supportedEntityTailTypes(vp)) - ), - location, ctx + unsupportedTagMsg(tailTypeRef.toString(), supportedEntityTailTypes(vp)), location, ctx ); } @@ -422,11 +413,7 @@ private static void supportedEntityTailTypes(@NotNull GenVarProjection if (targetType == null) { throw new PsiProcessingException( - String.format( - "Unknown tail type '%s'. Supported tail types: {%s}", - tailTypeRef.toString(), - String.join(", ", supportedModelTailTypes(mp)) - ), location, ctx + unsupportedTailMsg(tailTypeRef.toString(), supportedModelTailTypes(mp)), location, ctx ); } return targetType; @@ -545,4 +532,8 @@ public static String unsupportedFieldMsg(String name, Collection support public static String unsupportedTagMsg(String name, Collection supported) { return unsupportedObjMsg("Tag", "tags", name, supported); } + + public static String unsupportedTailMsg(String name, Collection supported) { + return unsupportedObjMsg("Tail type", "tail types", name, supported); + } } diff --git a/java/projections-url-psi-parser/src/test/java/ws/epigraph/url/projections/req/output/ReqOutputProjectionsParserTest.java b/java/projections-url-psi-parser/src/test/java/ws/epigraph/url/projections/req/output/ReqOutputProjectionsParserTest.java index 904848ff3..ff2bb4241 100644 --- a/java/projections-url-psi-parser/src/test/java/ws/epigraph/url/projections/req/output/ReqOutputProjectionsParserTest.java +++ b/java/projections-url-psi-parser/src/test/java/ws/epigraph/url/projections/req/output/ReqOutputProjectionsParserTest.java @@ -570,7 +570,7 @@ public void testNonExistingEntityTailErrorMsg() { fail(); } catch (@SuppressWarnings("ErrorNotRethrown") AssertionError e) { assertTrue(e.getMessage(), e.getMessage() - .contains("Unknown tail type 'X'. Supported tail types: {ws.epigraph.tests.User, ws.epigraph.tests.User2}")); + .contains("Tag 'X' is not supported, supported tags: (ws.epigraph.tests.User,ws.epigraph.tests.User2)")); } } @@ -585,7 +585,7 @@ public void testWrongEntityTailErrorMsg() { assertTrue( message, message.contains( - "Polymorphic tail for type 'ws.epigraph.tests.SingleTagEntity' is not supported. Supported tail types: {ws.epigraph.tests.User, ws.epigraph.tests.User2}") + "Tag 'ws.epigraph.tests.SingleTagEntity' is not supported, did you mean 'ws.epigraph.tests.User'? Supported tags: (ws.epigraph.tests.User,ws.epigraph.tests.User2)") ); } } @@ -597,7 +597,7 @@ public void testNonExistingModelTailErrorMsg() { fail(); } catch (@SuppressWarnings("ErrorNotRethrown") AssertionError e) { assertTrue(e.getMessage(), e.getMessage() - .contains("Unknown tail type 'X'. Supported tail types: {ws.epigraph.tests.UserRecord}")); + .contains("Tail type 'X' is not supported, supported tail types: (ws.epigraph.tests.UserRecord)")); } }