Spaces:
Build error
Build error
File size: 744 Bytes
d9494a5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import { assertUnreachable } from 'twenty-shared/utils';
import { FlatEntityMapsExceptionCode } from 'src/engine/metadata-modules/flat-entity/exceptions/flat-entity-maps.exception';
export const flatEntityMapsExceptionCodeToHttpStatus = (
code: keyof typeof FlatEntityMapsExceptionCode,
): number => {
switch (code) {
case FlatEntityMapsExceptionCode.ENTITY_NOT_FOUND:
return 404;
case FlatEntityMapsExceptionCode.ENTITY_ALREADY_EXISTS:
return 409;
case FlatEntityMapsExceptionCode.RELATION_UNIVERSAL_IDENTIFIER_NOT_FOUND:
case FlatEntityMapsExceptionCode.ENTITY_MALFORMED:
case FlatEntityMapsExceptionCode.INTERNAL_SERVER_ERROR:
return 500;
default:
return assertUnreachable(code);
}
};
|