Skip to content

Commit 95cc38b

Browse files
authored
Merge pull request #99 from Canas/fix-arn-undefined-error
fix: gracefully handle logName on undefined Arn
2 parents 208ba49 + f7983ad commit 95cc38b

File tree

3 files changed

+288680
-58694
lines changed

3 files changed

+288680
-58694
lines changed

code-build.js

+14-9
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,18 @@ function buildSdk() {
234234
}
235235

236236
function logName(Arn) {
237-
const [logGroupName, logStreamName] = Arn.split(":log-group:")
238-
.pop()
239-
.split(":log-stream:");
240-
if (logGroupName === "null" || logStreamName === "null")
241-
return {
242-
logGroupName: undefined,
243-
logStreamName: undefined,
244-
};
245-
return { logGroupName, logStreamName };
237+
const logs = {
238+
logGroupName: undefined,
239+
logStreamName: undefined,
240+
};
241+
if (Arn) {
242+
const [logGroupName, logStreamName] = Arn.split(":log-group:")
243+
.pop()
244+
.split(":log-stream:");
245+
if (logGroupName !== "null" && logStreamName !== "null") {
246+
logs.logGroupName = logGroupName;
247+
logs.logStreamName = logStreamName;
248+
}
249+
}
250+
return logs;
246251
}

0 commit comments

Comments
 (0)