Skip to content

Commit 58a869b

Browse files
committed
Add custom exception: UnableToLoadFreeMarkerTemplateException
1 parent 17feae2 commit 58a869b

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

graphql-codegen-gradle-plugin/src/main/java/com/kobylynskyi/graphql/codegen/FreeMarkerTemplatesRegistry.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.kobylynskyi.graphql.codegen;
22

3+
import com.kobylynskyi.graphql.codegen.model.UnableToLoadFreeMarkerTemplateException;
34
import freemarker.template.Configuration;
45
import freemarker.template.Template;
56
import freemarker.template.TemplateExceptionHandler;
@@ -29,7 +30,7 @@ class FreeMarkerTemplatesRegistry {
2930
interfaceTemplate = configuration.getTemplate("templates/javaClassGraphqlInterface.ftl");
3031
operationsTemplate = configuration.getTemplate("templates/javaClassGraphqlOperations.ftl");
3132
} catch (IOException e) {
32-
throw new RuntimeException("Unable to load FreeMarker templates", e);
33+
throw new UnableToLoadFreeMarkerTemplateException(e);
3334
}
3435
}
3536
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.kobylynskyi.graphql.codegen.model;
2+
3+
/**
4+
* Exception that indicates error while loading Apache FreeMarker template
5+
*
6+
* @author kobylynskyi
7+
*/
8+
public class UnableToLoadFreeMarkerTemplateException extends RuntimeException {
9+
10+
public UnableToLoadFreeMarkerTemplateException(Throwable e) {
11+
super("Unable to load FreeMarker templates", e);
12+
}
13+
14+
}

graphql-codegen-gradle-plugin/src/main/java/com/kobylynskyi/graphql/codegen/model/UnsupportedGraphqlDefinitionException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import graphql.language.Definition;
44

55
/**
6-
* Generic exception that indicates some code generation error
6+
* Exception that indicates unknown/unsupported GraphQL definition
77
*
88
* @author kobylynskyi
99
*/

0 commit comments

Comments
 (0)