Skip to content

v0.90.0

Choose a tag to compare

@github-actions github-actions released this 21 Aug 12:45
· 59 commits to main since this release
546ff19

0.90.0 (2025-08-21)

Breaking changes

  • @prefabs.tech/fastify-firebase, @prefabs.tech/fastify-s3, @prefabs.tech/fastify-user now requires @prefabs.tech/fastify-error-handler package for handling http errors and other custom errors.

Bug Fixes

  • user/photo: fix photo upload (#1005) (f32a4e0)

  • user/invitation: create invitaion endpoint now check if role is exists or not, if not exist throws error.

  • error-handler fix ErrorResponse fastify schema and update error handler.

Error Handling Guidelines

Controllers must not reply with non-200 responses

Do not manually send error responses from controllers.

Instead, always throw an error and let the global error handler handle formatting and response.

Wrong

fastify.get('/test', async (req, reply) => {
  return reply.code(401).send({ message: "Unauthorized" });
})

Correct

fastify.get('/test', async (req, reply) => {
  throw fastify.httpErrors.unauthorized("Unauthorized");
})

Throw CustomError (or subclass)

  • Modules must throw an instance of CustomError (or a class extending it).
  • This ensures errors can be consistently caught and appropriate actions taken.
import { CustomError } from "@prefabs.tech/fastify-error-handler";

const file = fileService.findById(1);

if (!file) {
  throw new CustomError("File not found", "FILE_NOT_FOUND_ERROR");
}