mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
refactor: Authentication service.
This commit is contained in:
11
server/src/exceptions/ServiceError.ts
Normal file
11
server/src/exceptions/ServiceError.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
export default class ServiceError {
|
||||
errorType: string;
|
||||
message: string;
|
||||
|
||||
constructor(errorType: string, message?: string) {
|
||||
this.errorType = errorType;
|
||||
this.message = message || null;
|
||||
}
|
||||
}
|
||||
15
server/src/exceptions/ServiceErrors.ts
Normal file
15
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
|
||||
.filter((error: ServiceError) => error.errorType === errorType);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
import NotAllowedChangeSubscriptionPlan from './NotAllowedChangeSubscriptionPlan';
|
||||
import ServiceError from './ServiceError';
|
||||
import ServiceErrors from './ServiceErrors';
|
||||
|
||||
export {
|
||||
NotAllowedChangeSubscriptionPlan,
|
||||
ServiceError,
|
||||
ServiceErrors,
|
||||
};
|
||||
Reference in New Issue
Block a user