File tree Expand file tree Collapse file tree 5 files changed +20
-7
lines changed
packages/sirius-web/backend
sirius-web-infrastructure/src/main/java/org/eclipse/sirius/web/infrastructure/elasticsearch/services
sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/omnibox Expand file tree Collapse file tree 5 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -271,6 +271,7 @@ The only difference is that this new marker has a second range of two dots after
271271- https://github.com/eclipse-sirius/sirius-web/issues/6101[#6101] [sirius-web] Allow more control of the redirect URL in the new project card
272272- https://github.com/eclipse-sirius/sirius-web/issues/5909[#5909] [graphql] Improve the customization of GraphQL error messages
273273- https://github.com/eclipse-sirius/sirius-web/issues/5947[#5947] [sirius-web] Add support for publishing libraries from non-main editing contexts.
274+ - https://github.com/eclipse-sirius/sirius-web/issues/6044[#6044] [sirius-web] Properly catch `ElasticsearchException`
274275
275276
276277
Original file line number Diff line number Diff line change 11/*******************************************************************************
2- * Copyright (c) 2025 Obeo.
2+ * Copyright (c) 2025, 2026 Obeo.
33 * This program and the accompanying materials
44 * are made available under the terms of the Eclipse Public License v2.0
55 * which accompanies this distribution, and is available at
2323import org .springframework .stereotype .Service ;
2424
2525import co .elastic .clients .elasticsearch .ElasticsearchClient ;
26+ import co .elastic .clients .elasticsearch ._types .ElasticsearchException ;
2627
2728/**
2829 * The default implementation that creates the index for an editing context.
@@ -65,7 +66,7 @@ public boolean createIndex(String editingContextId) {
6566 textPropertyBuilder .index (false )))));
6667 indexCreated = true ;
6768 }
68- } catch (IOException exception ) {
69+ } catch (IOException | ElasticsearchException exception ) {
6970 this .logger .warn ("An error occurred while creating the index" , exception );
7071 }
7172 }
Original file line number Diff line number Diff line change 11/*******************************************************************************
2- * Copyright (c) 2025 Obeo.
2+ * Copyright (c) 2025, 2026 Obeo.
33 * This program and the accompanying materials
44 * are made available under the terms of the Eclipse Public License v2.0
55 * which accompanies this distribution, and is available at
2222import org .springframework .stereotype .Service ;
2323
2424import co .elastic .clients .elasticsearch .ElasticsearchClient ;
25+ import co .elastic .clients .elasticsearch ._types .ElasticsearchException ;
2526
2627/**
2728 * The default implementation that deletes the index for an editing context.
@@ -49,7 +50,7 @@ public boolean deleteIndex(String editingContextId) {
4950 elasticSearchClient .indices ().delete (deleteIndexRequest -> deleteIndexRequest .index (DefaultIndexCreationService .EDITING_CONTEXT_INDEX_NAME_PREFIX + editingContextId ));
5051 indexDeleted = true ;
5152 }
52- } catch (IOException exception ) {
53+ } catch (IOException | ElasticsearchException exception ) {
5354 this .logger .warn ("An error occurred while deleting the index" , exception );
5455 }
5556 }
Original file line number Diff line number Diff line change 11/*******************************************************************************
2- * Copyright (c) 2025 Obeo.
2+ * Copyright (c) 2025, 2026 Obeo.
33 * This program and the accompanying materials
44 * are made available under the terms of the Eclipse Public License v2.0
55 * which accompanies this distribution, and is available at
2626import org .springframework .stereotype .Service ;
2727
2828import co .elastic .clients .elasticsearch .ElasticsearchClient ;
29+ import co .elastic .clients .elasticsearch ._types .ElasticsearchException ;
2930import co .elastic .clients .elasticsearch .core .SearchResponse ;
3031import co .elastic .clients .elasticsearch .core .search .Hit ;
3132
@@ -67,7 +68,7 @@ public List<IIndexEntry> search(String query) {
6768 .allowLeadingWildcard (true )))
6869 , IIndexEntry .class );
6970 result = response .hits ().hits ().stream ().map (Hit ::source ).toList ();
70- } catch (IOException exception ) {
71+ } catch (IOException | ElasticsearchException exception ) {
7172 this .logger .warn ("An error occurred while querying indices" , exception );
7273 }
7374 }
Original file line number Diff line number Diff line change 11/*******************************************************************************
2- * Copyright (c) 2024, 2025 Obeo.
2+ * Copyright (c) 2024, 2026 Obeo.
33 * This program and the accompanying materials
44 * are made available under the terms of the Eclipse Public License v2.0
55 * which accompanies this distribution, and is available at
@@ -270,6 +270,15 @@ public void givenQueryWhenObjectsAreSearchedInProjectsOmniboxThenObjectsAreRetur
270270 assertThat (complexQueryObjectLabels ).isNotEmpty ()
271271 .anyMatch (label -> label .contains ("org.eclipse.sirius.web.tests.data" ))
272272 .anyMatch (label -> label .contains ("Success" ));
273+
274+ Map <String , Object > queryWithSyntaxErrorVariables = Map .of (
275+ "query" , "name::Comp*"
276+ );
277+
278+ var queryWithSyntaxErrorResult = this .projectsOmniboxSearchQueryRunner .run (queryWithSyntaxErrorVariables );
279+ assertThat (queryWithSyntaxErrorResult .errors ()).isEmpty ();
280+ List <String > queryWithSyntaxErrorObjectLabels = JsonPath .read (queryWithSyntaxErrorResult .data (), "$.data.viewer.projectsOmniboxSearch.edges[*].node.label" );
281+ assertThat (queryWithSyntaxErrorObjectLabels ).isEmpty ();
273282 }
274283
275284}
You can’t perform that action at this time.
0 commit comments