From 7a5c813d9ca913cd9a2f03a58902b2a9bf5c7f23 Mon Sep 17 00:00:00 2001 From: Cody Roseborough Date: Fri, 28 Sep 2018 11:23:01 -0700 Subject: [PATCH] Return more context on awslogs create failure Signed-off-by: Cody Roseborough --- daemon/logger/awslogs/cloudwatchlogs.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/daemon/logger/awslogs/cloudwatchlogs.go b/daemon/logger/awslogs/cloudwatchlogs.go index 0f989af379..3892109886 100644 --- a/daemon/logger/awslogs/cloudwatchlogs.go +++ b/daemon/logger/awslogs/cloudwatchlogs.go @@ -375,13 +375,17 @@ func (l *logStream) create() error { if l.logCreateGroup { if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == resourceNotFoundCode { if err := l.createLogGroup(); err != nil { - return err + return errors.Wrap(err, "failed to create Cloudwatch log group") } - return l.createLogStream() + err := l.createLogStream() + if err != nil { + return errors.Wrap(err, "failed to create Cloudwatch log stream") + } + return nil } } if err != nil { - return err + return errors.Wrap(err, "failed to create Cloudwatch log stream") } }