Repository: freeCodeCamp/freeCodeCamp
File: api/src/routes/challenge.ts (TypeScript)

Code before:
          completedDate: completedChallenge.completedDate,
          savedChallenges
        };
      } catch (error) {
        fastify.log.error(error);
        void reply.code(500);
        return {
          message:
            'Oops! Something went wrong. Please try again in a moment or contact support@freecodecamp.org if the error persists.',
          type: 'danger'
        } as const;
      }
    }
  );

  fastify.post(
    '/save-challenge',
    {
      schema: schemas.saveChallenge,
      errorHandler(error, request, reply) {
        if (error.validation) {
          void reply.code(403);
          return formatProjectCompletedValidation(
            error.validation,
            'That challenge type is not savable.'
          );
        } else {
          fastify.errorHandler(error, request, reply);
        }
      }
    },
    async (req, reply) => {
      try {
        const { files, id: challengeId } = req.body;
        const user = await fastify.prisma.user.findUniqueOrThrow({
          where: { id: req.session.user.id }
        });
        const challenge = {
          id: challengeId,
          files
        };

        if (!multifileCertProjectIds.includes(challengeId)) {
          void reply.code(403);
          return {
            type: 'error',
            message: 'That challenge type is not savable.'
          } as const;
        }

        const userSavedChallenges = saveUserChallengeData(

Review comment (suggestion):
I think I was a little overzealous applying this function, but, regardless, all the validation errors have the same response, so:
```suggestion
          return {
            type: 'error',
            message: 'That does not appear to be a valid challenge submission.'
          };
```

Code after:
          completedDate: completedChallenge.completedDate,
          savedChallenges
        };
      } catch (error) {
        fastify.log.error(error);
        void reply.code(500);
        return {
          message:
            'Oops! Something went wrong. Please try again in a moment or contact support@freecodecamp.org if the error persists.',
          type: 'danger'
        } as const;
      }
    }
  );

  fastify.post(
    '/save-challenge',
    {
      schema: schemas.saveChallenge,
      errorHandler(error, request, reply) {
        if (error.validation) {
          void reply.code(400);
          return formatProjectCompletedValidation(error.validation);
        } else {
          fastify.errorHandler(error, request, reply);
        }
      }
    },
    async (req, reply) => {
      try {
        const { files, id: challengeId } = req.body;
        const user = await fastify.prisma.user.findUniqueOrThrow({
          where: { id: req.session.user.id }
        });
        const challenge = {
          id: challengeId,
          files
        };

        if (!multifileCertProjectIds.includes(challengeId)) {
          void reply.code(403);
          return 'That challenge type is not savable.';
        }

        const userSavedChallenges = saveUserChallengeData(
          challengeId,
          user.savedChallenges,
          challenge
        );

        await fastify.prisma.user.update({