mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
fix: refactor trpc errors (#1511)
This commit is contained in:
@ -2,6 +2,7 @@ import sharp from 'sharp';
|
||||
|
||||
import { prisma } from '@documenso/prisma';
|
||||
|
||||
import { AppError, AppErrorCode } from '../../errors/app-error';
|
||||
import type { RequestMetadata } from '../../universal/extract-request-metadata';
|
||||
|
||||
export type SetAvatarImageOptions = {
|
||||
@ -29,7 +30,9 @@ export const setAvatarImage = async ({
|
||||
});
|
||||
|
||||
if (!user) {
|
||||
throw new Error('User not found');
|
||||
throw new AppError(AppErrorCode.NOT_FOUND, {
|
||||
message: 'User not found',
|
||||
});
|
||||
}
|
||||
|
||||
oldAvatarImageId = user.avatarImageId;
|
||||
@ -47,7 +50,9 @@ export const setAvatarImage = async ({
|
||||
});
|
||||
|
||||
if (!team) {
|
||||
throw new Error('Team not found');
|
||||
throw new AppError('TEAM_NOT_FOUND', {
|
||||
statusCode: 404,
|
||||
});
|
||||
}
|
||||
|
||||
oldAvatarImageId = team.avatarImageId;
|
||||
|
||||
Reference in New Issue
Block a user