diff --git a/api/src/middlewares/ErrorHandler.ts b/api/src/middlewares/ErrorHandler.ts
index 96e703ce..2012b91c 100644
--- a/api/src/middlewares/ErrorHandler.ts
+++ b/api/src/middlewares/ErrorHandler.ts
@@ -1,8 +1,6 @@
import { NextFunction, Request, Response } from "express";
import { HTTPError } from "lambert-server";
-import { EntityNotFoundError } from "typeorm";
-import { FieldError } from "@fosscord/api";
-import { ApiError } from "@fosscord/util";
+import { ApiError, FieldError } from "@fosscord/util";
const EntityNotFoundErrorRegex = /"(\w+)"/;
export function ErrorHandler(error: Error, req: Request, res: Response, next: NextFunction) {
diff --git a/api/src/util/FieldError.ts b/api/src/util/FieldError.ts
deleted file mode 100644
index 0b3f93d2..00000000
--- a/api/src/util/FieldError.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import "missing-native-js-functions";
-
-export function FieldErrors(fields: Record<string, { code?: string; message: string }>) {
- return new FieldError(
- 50035,
- "Invalid Form Body",
- fields.map(({ message, code }) => ({
- _errors: [
- {
- message,
- code: code || "BASE_TYPE_INVALID"
- }
- ]
- }))
- );
-}
-
-// TODO: implement Image data type: Data URI scheme that supports JPG, GIF, and PNG formats. An example Data URI format is: data:image/jpeg;base64,BASE64_ENCODED_JPEG_IMAGE_DATA
-// Ensure you use the proper content type (image/jpeg, image/png, image/gif) that matches the image data being provided.
-
-export class FieldError extends Error {
- constructor(public code: string | number, public message: string, public errors?: any) {
- super(message);
- }
-}
diff --git a/api/src/util/String.ts b/api/src/util/String.ts
index 67d87e37..982b7e11 100644
--- a/api/src/util/String.ts
+++ b/api/src/util/String.ts
@@ -1,6 +1,6 @@
import { Request } from "express";
import { ntob } from "./Base64";
-import { FieldErrors } from "./FieldError";
+import { FieldErrors } from "@fosscord/util";
export function checkLength(str: string, min: number, max: number, key: string, req: Request) {
if (str.length < min || str.length > max) {
diff --git a/api/src/util/index.ts b/api/src/util/index.ts
index 3e47ce4e..238787c9 100644
--- a/api/src/util/index.ts
+++ b/api/src/util/index.ts
@@ -1,5 +1,4 @@
export * from "./Base64";
-export * from "./FieldError";
export * from "./ipAddress";
export * from "./Message";
export * from "./passwordStrength";
diff --git a/api/src/util/route.ts b/api/src/util/route.ts
index 3e967e2a..e4794eb5 100644
--- a/api/src/util/route.ts
+++ b/api/src/util/route.ts
@@ -3,6 +3,7 @@ import {
EVENT,
Event,
EventData,
+ FieldErrors,
FosscordApiErrors,
getPermission,
PermissionResolvable,
@@ -15,7 +16,6 @@ import fs from "fs";
import path from "path";
import Ajv from "ajv";
import { AnyValidateFunction } from "ajv/dist/core";
-import { FieldErrors } from "..";
import addFormats from "ajv-formats";
const SchemaPath = path.join(__dirname, "..", "..", "assets", "schemas.json");
|