e0563377b5
https://github.com/user-attachments/assets/8f8f1122-3de1-4a9b-8bb4-a3c8d31e47ae --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Charles Bochet <charles@twenty.com>
22 lines
759 B
TypeScript
22 lines
759 B
TypeScript
import { UserInputError } from 'src/engine/core-modules/graphql/utils/graphql-errors.util';
|
|
import {
|
|
ViewGroupException,
|
|
ViewGroupExceptionCode,
|
|
} from 'src/engine/metadata-modules/view-group/exceptions/view-group.exception';
|
|
import { viewGraphqlApiExceptionHandler } from 'src/engine/metadata-modules/view/utils/view-graphql-api-exception-handler.util';
|
|
|
|
export const viewGroupGraphqlApiExceptionHandler = (error: Error) => {
|
|
if (error instanceof ViewGroupException) {
|
|
if (
|
|
error.code ===
|
|
ViewGroupExceptionCode.MISSING_MAIN_GROUP_BY_FIELD_METADATA_ID
|
|
) {
|
|
throw new UserInputError(error.message, {
|
|
userFriendlyMessage: error.userFriendlyMessage,
|
|
});
|
|
}
|
|
}
|
|
|
|
return viewGraphqlApiExceptionHandler(error);
|
|
};
|