Skip to content

Commit

Permalink
[Study guidance groups] Fix fetching of user's study guidance groups
Browse files Browse the repository at this point in the history
  • Loading branch information
valtterikantanen committed Aug 21, 2024
1 parent 2d3372d commit 02b3315
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions services/backend/src/services/studyGuidanceGroups.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as Sentry from '@sentry/node'
import { AxiosError } from 'axios'
import { uniq } from 'lodash'

import { StudyGuidanceGroupTag } from '../models/kone'
Expand Down Expand Up @@ -55,6 +57,11 @@ const getGroupsFromImporter = async (sisPersonId: string) => {
return studyGuidanceGroups
} catch (error) {
logger.error("Couldn't fetch users study guidance groups")
if (error instanceof AxiosError) {
logger.error(error.stack)
logger.error(JSON.stringify(error.response?.data))
Sentry.captureException(error)
}
return []
}
}
Expand Down
4 changes: 2 additions & 2 deletions services/backend/src/util/importerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ const getFdImporterClient = () => {
logger.error("Basic auth credentials not set, can't return client!")
return null
}
return toskaImporterClient
return fdImporterClient
}

const getToskaImporterClient = () => {
if (!importerToken) {
logger.error("Importer token not set, can't return client!")
return null
}
return fdImporterClient
return toskaImporterClient
}

export const getImporterClient = serviceProvider === 'toska' ? getToskaImporterClient : getFdImporterClient

0 comments on commit 02b3315

Please sign in to comment.