Skip to content

Commit

Permalink
Small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Schmid committed Mar 7, 2018
1 parent 9b1dd8b commit 2d75caf
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions lib/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,31 +66,31 @@ module.exports = {
// setup the stream filter correctly
return aliasGetAliasFunctionVersion
.then(version => {
if (version) {
return this.provider
.request('CloudWatchLogs',
'describeLogStreams',
params,
this.options.stage,
this.options.region)
.then(reply => {
if (!reply || _.isEmpty(reply.logStreams)) {
throw new this.serverless.classes
.Error('No existing streams for the function alias');
}
const logStreamNames = _.map(
_.filter(reply.logStreams, stream => _.includes(stream.logStreamName, `[${version}]`)),
stream => stream.logStreamName);

if (_.isEmpty(logStreamNames)) {
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'));
}
return logStreamNames;
});
if (!version) {
return BbPromise.reject(new this.serverless.classes.Error('Function alias not found.'));
}
return BbPromise.reject(new this.serverless.classes.Error('Function alias not found.'));
});

return this.provider
.request('CloudWatchLogs',
'describeLogStreams',
params,
this.options.stage,
this.options.region)
.then(reply => {
if (!reply || _.isEmpty(reply.logStreams)) {
throw new this.serverless.classes
.Error('No existing streams for the function alias');
}
const logStreamNames = _.map(
_.filter(reply.logStreams, stream => _.includes(stream.logStreamName, `[${version}]`)),
stream => stream.logStreamName);

if (_.isEmpty(logStreamNames)) {
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'));
}
return logStreamNames;
});
});
},

apiLogsGetLogStreams() {
Expand Down

0 comments on commit 2d75caf

Please sign in to comment.