Skip to content

Commit 2d75caf

Browse files
author
Frank Schmid
committed
Small fix
1 parent 9b1dd8b commit 2d75caf

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

lib/logs.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -66,31 +66,31 @@ module.exports = {
6666
// setup the stream filter correctly
6767
return aliasGetAliasFunctionVersion
6868
.then(version => {
69-
if (version) {
70-
return this.provider
71-
.request('CloudWatchLogs',
72-
'describeLogStreams',
73-
params,
74-
this.options.stage,
75-
this.options.region)
76-
.then(reply => {
77-
if (!reply || _.isEmpty(reply.logStreams)) {
78-
throw new this.serverless.classes
79-
.Error('No existing streams for the function alias');
80-
}
81-
const logStreamNames = _.map(
82-
_.filter(reply.logStreams, stream => _.includes(stream.logStreamName, `[${version}]`)),
83-
stream => stream.logStreamName);
84-
85-
if (_.isEmpty(logStreamNames)) {
86-
return BbPromise.reject(new this.serverless.classes.Error('No existing streams for the latest version of function alias. If you want to view logs of a specific function version, please use --version to specify'));
87-
}
88-
return logStreamNames;
89-
});
69+
if (!version) {
70+
return BbPromise.reject(new this.serverless.classes.Error('Function alias not found.'));
9071
}
91-
return BbPromise.reject(new this.serverless.classes.Error('Function alias not found.'));
92-
});
9372

73+
return this.provider
74+
.request('CloudWatchLogs',
75+
'describeLogStreams',
76+
params,
77+
this.options.stage,
78+
this.options.region)
79+
.then(reply => {
80+
if (!reply || _.isEmpty(reply.logStreams)) {
81+
throw new this.serverless.classes
82+
.Error('No existing streams for the function alias');
83+
}
84+
const logStreamNames = _.map(
85+
_.filter(reply.logStreams, stream => _.includes(stream.logStreamName, `[${version}]`)),
86+
stream => stream.logStreamName);
87+
88+
if (_.isEmpty(logStreamNames)) {
89+
return BbPromise.reject(new this.serverless.classes.Error('No existing streams for this function version. If you want to view logs of a specific function version, please use --version'));
90+
}
91+
return logStreamNames;
92+
});
93+
});
9494
},
9595

9696
apiLogsGetLogStreams() {

0 commit comments

Comments
 (0)