Skip to content

Commit

Permalink
rm interface IErrorType
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwalguptaofficial committed Nov 26, 2024
1 parent 86246aa commit e04f522
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 7,874 deletions.
15 changes: 4 additions & 11 deletions src/common/enums.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { IErrorType } from "./interfaces";

export const ERROR_TYPE = {
InvalidUpdateColumn: "invalid_update_column",
UndefinedColumn: "undefined_column",
Expand Down Expand Up @@ -29,15 +27,10 @@ export const ERROR_TYPE = {
MethodNotExist: 'method_not_exist',
Unknown: "unknown",
InvalidMiddleware: "invalid_middleware",
} as IErrorType;

if (process.env.NODE_ENV !== 'production') {
Object.assign(ERROR_TYPE, {
InvalidOrderQuery: 'invalid_order_query',
InvalidGroupQuery: 'invalid_group_query',
NoPrimaryKey: "no_primary_key"
});
}
InvalidOrderQuery: 'invalid_order_query',
InvalidGroupQuery: 'invalid_group_query',
NoPrimaryKey: 'no_primary_key'
};

export enum WORKER_STATUS {
Registered = "registerd",
Expand Down
36 changes: 1 addition & 35 deletions src/common/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export interface ISqlWeb {

export interface IDbStatus {
conStatus: CONNECTION_STATUS;
lastError?: IErrorType;
lastError?: typeof ERROR_TYPE;
}

export interface IPlugin {
Expand All @@ -208,37 +208,3 @@ export interface IDbInfo {
name: string;
version: number;
}

export interface IErrorType {
InvalidUpdateColumn: "invalid_update_column";
UndefinedColumn: "undefined_column";
UndefinedValue: "undefined_value";
UndefinedColumnName: "undefined_column_name";
UndefinedDbName: "undefined_database_name";
UndefinedColumnValue: "undefined_column_value";
NotArray: "not_array";
NoValueSupplied: "no_value_supplied";
ColumnNotExist: "column_not_exist";
NoIndexFound: "no_index_found";
InvalidOp: "invalid_operator";
NullValue: "null_value";
WrongDataType: "wrong_data_type";
TableNotExist: "table_not_exist";
DbNotExist: "db_not_exist";
ConnectionAborted: "connection_aborted";
ConnectionClosed: "connection_closed";
NotObject: "not_object";
InvalidConfig: "invalid_config";
DbBlocked: "Db_blocked";
IndexedDbNotSupported: "indexeddb_not_supported";
NullValueInWhere: "null_value_in_where";
InvalidJoinQuery: 'invalid_join_query';
InvalidOrderQuery: 'invalid_order_query';
InvalidQuery: 'invalid_query';
InvalidGroupQuery: 'invalid_group_query';
ImportScriptsFailed: 'import_scripts_failed';
MethodNotExist: 'method_not_exist';
Unknown: "unknown";
InvalidMiddleware: "invalid_middleware";
NoPrimaryKey: "no_primary_key";
}
6 changes: 3 additions & 3 deletions src/worker/executors/select/join.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Select } from "./";
import { IJoinQuery, DATA_TYPE, ERROR_TYPE, ISelectQuery, IErrorType } from "@/common";
import { IJoinQuery, DATA_TYPE, ERROR_TYPE, ISelectQuery } from "@/common";
import { getDataType, LogHelper, removeSpace, promiseReject, getKeys, getLength } from "@/worker/utils";
import { WhereChecker } from "@executors/where_checker";

Expand Down Expand Up @@ -179,7 +179,7 @@ class Join {
}
catch (ex) {
return promiseReject(
new LogHelper((ERROR_TYPE as IErrorType).InvalidOrderQuery, ex.message)
new LogHelper(ERROR_TYPE.InvalidOrderQuery, ex.message)
);
}
}
Expand Down Expand Up @@ -426,4 +426,4 @@ class Join {
type JoinTableInfo = {
table1: { table: string, column: string }
table2: { table: string, column: string }
};
};
Loading

0 comments on commit e04f522

Please sign in to comment.