Skip to content

Commit 197f294

Browse files
author
Artem
committed
add fix for other formatters
1 parent 5a6b1ec commit 197f294

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

redisinsight/api/src/common/transformers/redis-reply/strategies/ascii-formatter.strategy.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ export class ASCIIFormatterStrategy implements IFormatterStrategy {
3030
return result;
3131
}
3232

33-
private formatRedisObjectReply(reply: Object): object {
33+
private formatRedisObjectReply(reply: Object): object | string {
3434
const result = {};
35+
36+
if (reply instanceof Error) {
37+
return reply.toString();
38+
}
39+
3540
Object.keys(reply).forEach((key) => {
3641
result[key] = this.format(reply[key]);
3742
});

redisinsight/api/src/common/transformers/redis-reply/strategies/utf8-formatter.strategy.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ export class UTF8FormatterStrategy implements IFormatterStrategy {
3030
return result;
3131
}
3232

33-
private formatRedisObjectReply(reply: Object): object {
33+
private formatRedisObjectReply(reply: Object): object | string {
3434
const result = {};
35+
36+
if (reply instanceof Error) {
37+
return reply.toString();
38+
}
39+
3540
Object.keys(reply).forEach((key) => {
3641
result[key] = this.format(reply[key]);
3742
});

redisinsight/api/src/modules/cli/services/cli-business/output-formatter/strategies/utf-8-formatter.strategy.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ export class UTF8FormatterStrategy implements IOutputFormatterStrategy {
3030
return result;
3131
}
3232

33-
private formatRedisObjectReply(reply: Object): object {
33+
private formatRedisObjectReply(reply: Object): object | string {
3434
const result = {};
35+
36+
if (reply instanceof Error) {
37+
return reply.toString();
38+
}
39+
3540
Object.keys(reply).forEach((key) => {
3641
result[key] = this.format(reply[key]);
3742
});

0 commit comments

Comments
 (0)