Added specific errors for tenant creation errors
MODIFY
src/server/rest/v1/service/TenantService.ts
src/server/rest/v1/service/TenantService.ts
@@ -236,7 +236,7 @@ export default class TenantService {
if (foundTenant) {
throw new AppError({
source: Constants.CENTRAL_SERVER,
- errorCode: HTTPError.TENANT_ALREADY_EXIST,
+ errorCode: HTTPError.TENANT_NAME_ALREADY_EXIST,
message: `The tenant with name '${filteredRequest.name}' already exists`,
module: MODULE_NAME, method: 'handleCreateTenant',
user: req.user,
@@ -248,7 +248,7 @@ export default class TenantService {
if (foundTenant) {
throw new AppError({
source: Constants.CENTRAL_SERVER,
- errorCode: HTTPError.TENANT_ALREADY_EXIST,
+ errorCode: HTTPError.TENANT_SUBDOMAIN_ALREADY_EXIST,
message: `The tenant with subdomain '${filteredRequest.subdomain}' already exists`,
module: MODULE_NAME, method: 'handleCreateTenant',
user: req.user,

MODIFY
src/types/HTTPError.ts
src/types/HTTPError.ts
@@ -35,7 +35,8 @@ export enum HTTPError {
USER_ACCOUNT_INACTIVE_ERROR = 594,
USER_ACCOUNT_CHANGED = 595,
TENANT_COMPONENT_CHANGED = 596,
- TENANT_ALREADY_EXIST = 597,
+ TENANT_NAME_ALREADY_EXIST = 597,
+ TENANT_SUBDOMAIN_ALREADY_EXIST = 598,
INVALID_CAPTCHA = 530,
INVALID_TOKEN_ERROR = 540,

Added specific errors for tenant creation errors