Skip to content

Commit 7592c21

Browse files
catch 404 error for ldap overview (#11734) (#11738)
Co-authored-by: claire bontempo <[email protected]>
1 parent b7b7002 commit 7592c21

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

ui/lib/ldap/addon/components/page/overview.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,12 @@ export default class LdapLibrariesPageComponent extends Component<Args> {
9797
);
9898
this.checkInCapabilities = await this.capabilities.fetch(paths);
9999
} catch (error) {
100-
// Hierarchical discovery failed - display inline error
101-
this.librariesError = 'Unable to load complete library information. Please try refreshing the page.';
100+
const { status } = await this.api.parseError(error);
101+
// Only set error message if status is not a 404 which just means an empty response.
102+
if (status !== 404) {
103+
// Hierarchical discovery failed - display inline error
104+
this.librariesError = 'Unable to load complete library information. Please try refreshing the page.';
105+
}
102106
this.allLibraries = [];
103107
}
104108
});

ui/tests/integration/components/ldap/page/overview-test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,12 @@ module('Integration | Component | ldap | Page::Overview', function (hooks) {
197197
.dom('[data-test-overview-card-container="Accounts checked-out"]')
198198
.exists('AccountsCheckedOut component still renders when library discovery fails');
199199
});
200+
201+
test('it should display "None" when library request returns a 404', async function (assert) {
202+
// Override server to return empty 404 response for library requests
203+
this.apiLibraryStub.rejects(getErrorResponse({}, 404));
204+
await this.renderComponent();
205+
assert.dom('[data-test-libraries-error]').doesNotExist();
206+
assert.dom('[data-test-libraries-count]').hasText('None');
207+
});
200208
});

0 commit comments

Comments
 (0)