Skip to content
Merged
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 @@ -113,17 +113,21 @@ export class ContentPagesController {
): Promise<DbContentPage> {
try {
const user = sessionUser?.getUser();
return await this.contentPagesService.getContentPageByLanguageAndPathForUser(
const contentPage = await this.contentPagesService.getContentPageByLanguageAndPathForUser(
language || (user.language as Locale),
path,
user,
request?.headers?.Referrer as string,
ip,
onlyInfo === 'true'
);
if (!contentPage) {
throw new CustomError('ContentPage not found', null, {code: 'NOT_FOUND'}, 404);
}
return contentPage;
// biome-ignore lint/suspicious/noExplicitAny: error can be any type
} catch (err: any) {
if (err?.response?.additionalInfo?.code === 'NOT_FOUND') {
if (err?.response?.additionalInfo?.code === 'NOT_FOUND' || err?.statusCode === 404) {
throw new NotFoundException('The content page with path was not found');
}
const error = new CustomError('Failed to get content page by language and path', err, {
Expand Down