Skip to content

Commit

Permalink
Merge pull request #4229 from alkem-io/develop
Browse files Browse the repository at this point in the history
Logging
  • Loading branch information
techsmyth authored Jul 8, 2024
2 parents a49b4de + 0038b9a commit 048c566
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 30 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alkemio-server",
"version": "0.83.1",
"version": "0.83.2",
"description": "Alkemio server, responsible for managing the shared Alkemio platform",
"author": "Alkemio Foundation",
"private": false,
Expand Down
2 changes: 1 addition & 1 deletion quickstart-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ services:
- 'host.docker.internal:host-gateway'
container_name: alkemio_dev_matrix_adapter
hostname: matrix-adapter
image: alkemio/matrix-adapter:v0.4.3
image: alkemio/matrix-adapter:v0.4.4
platform: linux/x86_64
environment:
- RABBITMQ_HOST
Expand Down
1 change: 1 addition & 0 deletions src/common/enums/alkemio.error.status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export enum AlkemioErrorStatus {
AUTHORIZATION_INVALID_POLICY = 'AUTHORIZATION_INVALID_POLICY',
AUTHORIZATION_RESET = 'AUTHORIZATION_RESET',
BAD_USER_INPUT = 'BAD_USER_INPUT',
INPUT_VALIDATION_ERROR = 'INPUT VALIDATION_ERROR',
GROUP_NOT_INITIALIZED = 'GROUP_NOT_INITIALIZED',
ENTITY_NOT_INITIALIZED = 'ENTITY_NOT_INITIALIZED',
RELATION_NOT_LOADED = 'RELATION_NOT_LOADED',
Expand Down
12 changes: 0 additions & 12 deletions src/common/exceptions/user.input.error.ts

This file was deleted.

21 changes: 10 additions & 11 deletions src/common/exceptions/validation.exception.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { LogContext } from '@common/enums';
import { UserInputError } from './user.input.error';
import { AlkemioErrorStatus, LogContext } from '@common/enums';
import { BaseException } from './base.exception';
import { ExceptionDetails } from './exception.details';

export class ValidationException extends UserInputError {
private context: LogContext;
constructor(error: string, context: LogContext) {
super(error);
this.context = context;
}

getContext(): string {
return this.context;
export class ValidationException extends BaseException {
constructor(
message: string,
context: LogContext,
details?: ExceptionDetails
) {
super(message, context, AlkemioErrorStatus.BAD_USER_INPUT, details);
}
}
6 changes: 5 additions & 1 deletion src/core/authorization/authorization.rule.agent.privilege.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ export class AuthorizationRuleAgentPrivilege {
this.privilege
);
if (!accessGranted) {
let authorizationID = '';
if (this.fieldParent.authorization) {
authorizationID = this.fieldParent.authorization.id;
}
const fieldParentType = this.fieldParent.__proto__.constructor.name;
const errorMsg = `User (${agentInfo.email}) does not have credentials that grant '${this.privilege}' access to ${fieldParentType}.${this.fieldName}`;
const errorMsg = `User (${agentInfo.email}) does not have credentials that grant '${this.privilege}' access to ${fieldParentType}.${this.fieldName} on authorization: ${authorizationID}`;
this.authorizationService.logCredentialCheckFailDetails(
errorMsg,
agentInfo,
Expand Down
1 change: 1 addition & 0 deletions src/core/error-handling/graphql.exception.filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class GraphqlExceptionFilter implements GqlExceptionFilter {
return new GraphQLError(exception.message, {
extensions: {
errorId: exception.errorId,
code: exception.code,
},
});
}
Expand Down
4 changes: 3 additions & 1 deletion src/domain/collaboration/callout/callout.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ export class CalloutService {
}
if (!callout)
throw new EntityNotFoundException(
`No Callout found with the given id: ${calloutID}`,
`No Callout found with the given id: ${calloutID}, using options: ${JSON.stringify(
options
)}`,
LogContext.COLLABORATION
);
return callout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,12 @@ export class UrlGeneratorService {
LogContext.URL_GENERATOR
);
}
if (!result.collaborationId) {
throw new EntityNotFoundException(
`Unable to find collaboration for callout with id: ${calloutID}`,
LogContext.URL_GENERATOR
);
}
const collaborationJourneyUrlPath = await this.getJourneyUrlPath(
'collaborationId',
result.collaborationId
Expand All @@ -635,6 +641,12 @@ export class UrlGeneratorService {
fieldName: string,
fieldID: string
): Promise<string> {
if (!fieldID || fieldID === 'null') {
throw new EntityNotFoundException(
`Unable to find journey with ${fieldName}: ${fieldID}`,
LogContext.URL_GENERATOR
);
}
let collaborationJourneyUrlPath = await this.getSubsubspaceUrlPath(
fieldName,
fieldID
Expand All @@ -653,7 +665,7 @@ export class UrlGeneratorService {
}
if (!collaborationJourneyUrlPath) {
throw new EntityNotFoundException(
`Unable to find url path for collaboration: ${fieldID}`,
`Unable to find url path for collaboration: ${fieldName} - ${fieldID}`,
LogContext.URL_GENERATOR
);
}
Expand Down

0 comments on commit 048c566

Please sign in to comment.