sim-node-lib 0.4.14 → 0.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class ExceptionHelper {
|
|
4
|
+
static findMessage(obj) {
|
|
5
|
+
for (const key in obj) {
|
|
6
|
+
if (obj.hasOwnProperty(key)) {
|
|
7
|
+
if (key === 'message') {
|
|
8
|
+
return obj[key];
|
|
9
|
+
}
|
|
10
|
+
else if (typeof obj[key] === 'object') {
|
|
11
|
+
const nestedResult = ExceptionHelper.findMessage(obj[key]);
|
|
12
|
+
if (nestedResult !== undefined) {
|
|
13
|
+
return nestedResult;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return 'Não foi encontrada uma mensagem nesse objeto.';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.default = ExceptionHelper;
|