mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 04:10:32 +00:00
add server to monorepo.
This commit is contained in:
9
packages/server/src/exceptions/HttpException.ts
Normal file
9
packages/server/src/exceptions/HttpException.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
class HttpException extends Error {
|
||||
public status: number;
|
||||
public message: string;
|
||||
constructor(status: number, message: string) {
|
||||
super(message);
|
||||
this.status = status;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
8
packages/server/src/exceptions/ModelEntityNotFound.ts
Normal file
8
packages/server/src/exceptions/ModelEntityNotFound.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
export default class ModelEntityNotFound extends Error {
|
||||
|
||||
constructor(entityId, message?) {
|
||||
message = message || `Entity with id ${entityId} does not exist`;
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
export default class NoPaymentModelWithPricedPlan {
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
export default class NotAllowedChangeSubscriptionPlan {
|
||||
|
||||
constructor() {
|
||||
this.name = "NotAllowedChangeSubscriptionPlan";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
export default class PaymentAmountInvalidWithPlan{
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
5
packages/server/src/exceptions/PaymentInputInvalid.ts
Normal file
5
packages/server/src/exceptions/PaymentInputInvalid.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
export default class PaymentInputInvalid {
|
||||
constructor() {}
|
||||
}
|
||||
14
packages/server/src/exceptions/ServiceError.ts
Normal file
14
packages/server/src/exceptions/ServiceError.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
export default class ServiceError {
|
||||
errorType: string;
|
||||
message: string;
|
||||
payload: any;
|
||||
|
||||
constructor(errorType: string, message?: string, payload?: any) {
|
||||
this.errorType = errorType;
|
||||
this.message = message || null;
|
||||
|
||||
this.payload = payload;
|
||||
}
|
||||
}
|
||||
15
packages/server/src/exceptions/ServiceErrors.ts
Normal file
15
packages/server/src/exceptions/ServiceErrors.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import ServiceError from './ServiceError';
|
||||
|
||||
|
||||
export default class ServiceErrors {
|
||||
errors: ServiceError[];
|
||||
|
||||
constructor(errors: ServiceError[]) {
|
||||
this.errors = errors;
|
||||
}
|
||||
|
||||
hasType(errorType: string) {
|
||||
return this.errors
|
||||
.some((error: ServiceError) => error.errorType === errorType);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
export default class TenantAlreadyInitialized {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
9
packages/server/src/exceptions/TenantAlreadySeeded.ts
Normal file
9
packages/server/src/exceptions/TenantAlreadySeeded.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
|
||||
|
||||
export default class TenantAlreadySeeded {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
9
packages/server/src/exceptions/TenantDBAlreadyExists.ts
Normal file
9
packages/server/src/exceptions/TenantDBAlreadyExists.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
|
||||
|
||||
export default class TenantDBAlreadyExists {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
7
packages/server/src/exceptions/TenantDatabaseNotBuilt.ts
Normal file
7
packages/server/src/exceptions/TenantDatabaseNotBuilt.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
export default class TenantDatabaseNotBuilt {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
6
packages/server/src/exceptions/VoucherCodeRequired.ts
Normal file
6
packages/server/src/exceptions/VoucherCodeRequired.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
export default class VoucherCodeRequired {
|
||||
constructor() {
|
||||
this.name = 'VoucherCodeRequired';
|
||||
}
|
||||
}
|
||||
25
packages/server/src/exceptions/index.ts
Normal file
25
packages/server/src/exceptions/index.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import NotAllowedChangeSubscriptionPlan from './NotAllowedChangeSubscriptionPlan';
|
||||
import ServiceError from './ServiceError';
|
||||
import ServiceErrors from './ServiceErrors';
|
||||
import NoPaymentModelWithPricedPlan from './NoPaymentModelWithPricedPlan';
|
||||
import PaymentInputInvalid from './PaymentInputInvalid';
|
||||
import PaymentAmountInvalidWithPlan from './PaymentAmountInvalidWithPlan';
|
||||
import TenantAlreadyInitialized from './TenantAlreadyInitialized';
|
||||
import TenantAlreadySeeded from './TenantAlreadySeeded';
|
||||
import TenantDBAlreadyExists from './TenantDBAlreadyExists';
|
||||
import TenantDatabaseNotBuilt from './TenantDatabaseNotBuilt';
|
||||
import VoucherCodeRequired from './VoucherCodeRequired';
|
||||
|
||||
export {
|
||||
NotAllowedChangeSubscriptionPlan,
|
||||
NoPaymentModelWithPricedPlan,
|
||||
PaymentAmountInvalidWithPlan,
|
||||
ServiceError,
|
||||
ServiceErrors,
|
||||
PaymentInputInvalid,
|
||||
TenantAlreadyInitialized,
|
||||
TenantAlreadySeeded,
|
||||
TenantDBAlreadyExists,
|
||||
TenantDatabaseNotBuilt,
|
||||
VoucherCodeRequired,
|
||||
};
|
||||
Reference in New Issue
Block a user