Skip to content

Commit 1be39f6

Browse files
committed
Clear container and type registry only if exception is thrown
1 parent e273ffb commit 1be39f6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/graphql/annotations/processor/GraphQLAnnotations.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* Copyright 2016 Yurii Rashkovskii
3-
*
3+
* <p>
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
7+
* <p>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p>
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -103,9 +103,10 @@ public static GraphQLObjectType object(Class<?> object) throws GraphQLAnnotation
103103
GraphQLAnnotations instance = getInstance();
104104
try {
105105
return instance.graphQLObjectHandler.getObject(object, instance.getContainer());
106-
} finally {
106+
} catch (GraphQLAnnotationsException e) {
107107
instance.getContainer().getProcessing().clear();
108108
instance.getTypeRegistry().clear();
109+
throw e;
109110
}
110111
}
111112

0 commit comments

Comments
 (0)