Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not warn when switching capabilities for resources with optional auth #61043

Merged
merged 2 commits into from
Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ describe('capabilitiesSwitcher', () => {
expect(result).toEqual(buildCapabilities());
});

it('logs a warning, and does not toggle capabilities if an error is encountered', async () => {
it('logs a debug message, and does not toggle capabilities if an error is encountered', async () => {
const space: Space = {
id: 'space',
name: '',
Expand All @@ -171,7 +171,7 @@ describe('capabilitiesSwitcher', () => {
const result = await switcher(request, capabilities);

expect(result).toEqual(buildCapabilities());
expect(logger.warn).toHaveBeenCalledWith(
expect(logger.debug).toHaveBeenCalledWith(
`Error toggling capabilities for request to /path: Error: Something terrible happened`
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ export function setupCapabilitiesSwitcher(

const registeredFeatures = features.getFeatures();

// try to retrieve capabilities for authenticated or "maybe authenticated" users
return toggleCapabilities(registeredFeatures, capabilities, activeSpace);
} catch (e) {
logger.warn(`Error toggling capabilities for request to ${request.url.pathname}: ${e}`);
logger.debug(`Error toggling capabilities for request to ${request.url.pathname}: ${e}`);
return capabilities;
}
};
Expand Down