Skip to content

Commit

Permalink
feat: separate errors for static was not implemented metods[3966]
Browse files Browse the repository at this point in the history
  • Loading branch information
Ihar committed Aug 26, 2024
1 parent f74af03 commit 6a3480a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
46 changes: 23 additions & 23 deletions common/src/interfaces/database-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export abstract class AbstractDatabaseServer {
* @param db
*/
public static connectBD(db: IOrmConnection): void {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.connectBD.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -156,7 +156,7 @@ export abstract class AbstractDatabaseServer {
* @param all
*/
public static clearDryRun(dryRunId: string, all: boolean): Promise<void> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.clearDryRun.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand Down Expand Up @@ -200,7 +200,7 @@ export abstract class AbstractDatabaseServer {
* @virtual
*/
public static async getVirtualUser(policyId: string): Promise<DryRun | null> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getVirtualUser.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand Down Expand Up @@ -408,7 +408,7 @@ export abstract class AbstractDatabaseServer {
* @virtual
*/
public static getPublishPolicies(): Promise<Policy[]> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getPublishPolicies.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -417,7 +417,7 @@ export abstract class AbstractDatabaseServer {
* @virtual
*/
public static getPolicyCategories(): Promise<PolicyCategory[]> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getPolicyCategories.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -426,7 +426,7 @@ export abstract class AbstractDatabaseServer {
* @virtual
*/
public static getPolicyProperties(): Promise<PolicyProperty[]> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getPolicyProperties.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -437,7 +437,7 @@ export abstract class AbstractDatabaseServer {
* @returns {Policy[]} - found policies
*/
public static getFilteredPolicies(categoryIds: string[], text: string): Promise<Policy[]> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getFilteredPolicies.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand Down Expand Up @@ -1017,7 +1017,7 @@ export abstract class AbstractDatabaseServer {
active: boolean,
systemMode?: boolean
): Promise<void> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.createVirtualUser.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -1028,7 +1028,7 @@ export abstract class AbstractDatabaseServer {
* @virtual
*/
public static async saveVirtualMessage<T>(dryRun: string, message: Message): Promise<void> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.saveVirtualMessage.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -1039,7 +1039,7 @@ export abstract class AbstractDatabaseServer {
* @virtual
*/
public static async getVirtualMessages(dryRun: string, topicId: string | TopicId): Promise<DryRun[]> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getVirtualMessages.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -1050,7 +1050,7 @@ export abstract class AbstractDatabaseServer {
* @virtual
*/
public static async getVirtualMessage(dryRun: string, messageId: string): Promise<DryRun | null> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getVirtualMessage.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -1059,7 +1059,7 @@ export abstract class AbstractDatabaseServer {
* @returns Tokens
*/
public static async getTokens(filters?: Partial<TokenCollection>): Promise<TokenCollection[]> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getTokens.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -1068,7 +1068,7 @@ export abstract class AbstractDatabaseServer {
* @returns Saved Artifact
*/
public static async saveArtifact(artifact: ArtifactCollection): Promise<ArtifactCollection> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.saveArtifact.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -1077,7 +1077,7 @@ export abstract class AbstractDatabaseServer {
* @returns Artifact
*/
public static async getArtifact(filters?: Partial<ArtifactCollection>): Promise<ArtifactCollection | null> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getArtifact.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -1087,15 +1087,15 @@ export abstract class AbstractDatabaseServer {
* @returns Artifacts
*/
public static async getArtifacts(filters?: Partial<ArtifactCollection>, options?: unknown): Promise<ArtifactCollection[]> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getArtifacts.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
* Remove Artifact
* @param artifact Artifact
*/
public static async removeArtifact(artifact?: ArtifactCollection): Promise<void> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.removeArtifact.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -1104,7 +1104,7 @@ export abstract class AbstractDatabaseServer {
* @param data Data
*/
public static async saveArtifactFile(uuid: string, data: Buffer): Promise<void> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.saveArtifactFile.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`;
}

/**
Expand All @@ -1113,23 +1113,23 @@ export abstract class AbstractDatabaseServer {
* @returns Buffer
*/
public static async getArtifactFileByUUID(uuid: string): Promise<Buffer> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getArtifactFileByUUID.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
* Get Module By ID
* @param id
*/
public static async getModuleById(id: string): Promise<PolicyModule | null> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getModuleById.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
* Get Tool By ID
* @param id
*/
public static async getToolById(id: string): Promise<PolicyTool | null> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getToolById.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -1144,7 +1144,7 @@ export abstract class AbstractDatabaseServer {
* @param item
*/
public static async updateMultiPolicyTransactions(item: MultiPolicyTransaction): Promise<void> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.updateMultiPolicyTransactions.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -1153,14 +1153,14 @@ export abstract class AbstractDatabaseServer {
* @param item
*/
public static async updateSchema(id: string, item: SchemaCollection): Promise<void> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.updateSchema.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
* Update schemas
* @param items Schemas
*/
public static async updateSchemas(items: SchemaCollection[]): Promise<void> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.updateSchemas.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}
}
24 changes: 12 additions & 12 deletions common/src/interfaces/db-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@ export abstract class AbstractDataBaseHelper<T extends BaseEntity> {
* Set ORM
*/
public static set orm(orm: IOrmConnection) {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.set orm: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
* Get ORM
*/
public static get orm(): IOrmConnection | undefined {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.get orm: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
* Set MongoDriver
* @param db
*/
public static connectBD(db: IOrmConnection): void {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.connectBD.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -71,16 +71,16 @@ export abstract class AbstractDataBaseHelper<T extends BaseEntity> {
* @returns file ID
*/
public static async saveFile(uuid: string, buffer: Buffer): Promise<unknown> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.saveFile.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
* Load file
* @param id
* @returns file ID
*/
public static async loadFile(id: unknown): Promise<Buffer | null> {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
public static async loadFile(id: unknown): Promise<Buffer> {
throw new Error(`${this.name}.${this.loadFile.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand Down Expand Up @@ -130,7 +130,7 @@ export abstract class AbstractDataBaseHelper<T extends BaseEntity> {
* @returns Result
*/
public static getDocumentAggregationFilters(props: IGetDocumentAggregationFilters): void {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getDocumentAggregationFilters.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -140,7 +140,7 @@ export abstract class AbstractDataBaseHelper<T extends BaseEntity> {
* @returns Result
*/
public static getAnalyticsDocAggregationFilters(nameFilter: string, uuid: string): unknown[] {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getAnalyticsDocAggregationFilters.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -151,7 +151,7 @@ export abstract class AbstractDataBaseHelper<T extends BaseEntity> {
* @returns Result
*/
public static getAttributesAggregationFilters(nameFilterMap: string, nameFilterAttributes: string, existingAttributes: string[] | []): unknown[] {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getAttributesAggregationFilters.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -161,7 +161,7 @@ export abstract class AbstractDataBaseHelper<T extends BaseEntity> {
* @returns Result
*/
public static getTasksAggregationFilters(nameFilter: string, processTimeout: number): unknown[] {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getTasksAggregationFilters.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -170,7 +170,7 @@ export abstract class AbstractDataBaseHelper<T extends BaseEntity> {
* @returns Result
*/
public static getTransactionsSerialsAggregationFilters(props: IGetAggregationFilters): void {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this.getTransactionsSerialsAggregationFilters.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand All @@ -180,7 +180,7 @@ export abstract class AbstractDataBaseHelper<T extends BaseEntity> {
* @returns Aggregation filter
*/
public static _getTransactionsSerialsAggregation(mintRequestId: string, transferStatus?: unknown): unknown[] {
throw new Error(STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED);
throw new Error(`${this.name}.${this._getTransactionsSerialsAggregation.name}: ${STATUS_IMPLEMENTATION.METHOD_IS_NOT_IMPLEMENTED}`);
}

/**
Expand Down

0 comments on commit 6a3480a

Please sign in to comment.