File tree 2 files changed +15
-4
lines changed
packages/twenty-server/src/engine
core-modules/graphql/utils
2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -191,3 +191,9 @@ export class InternalServerError extends BaseGraphQLError {
191
191
Object . defineProperty ( this , 'name' , { value : 'InternalServerError' } ) ;
192
192
}
193
193
}
194
+
195
+ export class ExpiredAttachmentTokenError extends BaseGraphQLError {
196
+ constructor ( message = 'The attachment token has expired' ) {
197
+ super ( message , ErrorCode . UNAUTHENTICATED ) ;
198
+ }
199
+ }
Original file line number Diff line number Diff line change @@ -11,11 +11,12 @@ import {
11
11
BaseGraphQLError ,
12
12
ConflictError ,
13
13
ErrorCode ,
14
+ ExpiredAttachmentTokenError ,
14
15
ForbiddenError ,
15
16
MethodNotAllowedError ,
16
17
NotFoundError ,
17
18
TimeoutError ,
18
- ValidationError ,
19
+ ValidationError
19
20
} from 'src/engine/core-modules/graphql/utils/graphql-errors.util' ;
20
21
21
22
const graphQLPredefinedExceptions = {
@@ -101,12 +102,16 @@ export const convertExceptionToGraphQLError = (
101
102
const convertHttpExceptionToGraphql = ( exception : HttpException ) => {
102
103
const status = exception . getStatus ( ) ;
103
104
let error : BaseGraphQLError ;
105
+ const message = exception . getResponse ( ) [ 'message' ] ?? exception . message ;
104
106
105
107
if ( status in graphQLPredefinedExceptions ) {
106
- const message = exception . getResponse ( ) [ 'message' ] ?? exception . message ;
107
-
108
108
error = new graphQLPredefinedExceptions [ exception . getStatus ( ) ] ( message ) ;
109
- } else {
109
+
110
+ } else if ( message . includes ( 'attachment token expired' ) ) {
111
+ // Check if the error message indicates an expired attachment token
112
+ error = new ExpiredAttachmentTokenError ( message ) ;
113
+ }
114
+ else {
110
115
error = new BaseGraphQLError (
111
116
'Internal Server Error' ,
112
117
exception . getStatus ( ) . toString ( ) ,
You can’t perform that action at this time.
0 commit comments