Skip to content

Commit

Permalink
Merge pull request #15 from tarosky/issue/14
Browse files Browse the repository at this point in the history
Use Panic instead of Fatal
Close #14.
  • Loading branch information
harai authored Jan 17, 2021
2 parents 04baac4 + fd5f73c commit 4637e9e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions imgserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func (e *environment) runServer(ctx context.Context, engine *gin.Engine) {

go func() {
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
e.log.Fatal("server finished abnormally", zap.Error(err))
e.log.Panic("server finished abnormally", zap.Error(err))
}
}()

Expand All @@ -416,7 +416,7 @@ func (e *environment) runServer(ctx context.Context, engine *gin.Engine) {
ctx, time.Duration(e.gracefulShutdownTimeout)*time.Second)
defer cancel()
if err := srv.Shutdown(ctx2); err != nil {
e.log.Fatal("server forced to shutdown", zap.Error(err))
e.log.Panic("server forced to shutdown", zap.Error(err))
}
}

Expand Down Expand Up @@ -657,7 +657,7 @@ func (b *efsFileBody) Seek(offset int64, whence int) (int64, error) {
b.currOffset = offsetEnd
return b.size, nil
default:
b.log.Fatal("should not be called")
b.log.Panic("should not be called")
}

case offsetEnd:
Expand All @@ -671,14 +671,14 @@ func (b *efsFileBody) Seek(offset int64, whence int) (int64, error) {
case io.SeekCurrent, io.SeekEnd:
return seek()
default:
b.log.Fatal("should not be called")
b.log.Panic("should not be called")
}

case offsetUncontrolled:
return seek()
}

b.log.Fatal("should not be called")
b.log.Panic("should not be called")
return 0, nil
}

Expand All @@ -704,7 +704,7 @@ func (b *s3Body) Read(p []byte) (n int, err error) {
return 0, fmt.Errorf(
"reading when offset is end is not permitted in this implementation")
}
b.log.Fatal("should not be called")
b.log.Panic("should not be called")
return 0, nil
}

Expand Down Expand Up @@ -764,7 +764,7 @@ func (b *s3Body) Seek(offset int64, whence int) (int64, error) {
b.currOffset = offsetEnd
return b.size, nil
default:
b.log.Fatal("should not be called")
b.log.Panic("should not be called")
}

case offsetEnd:
Expand All @@ -778,7 +778,7 @@ func (b *s3Body) Seek(offset int64, whence int) (int64, error) {
case io.SeekCurrent, io.SeekEnd:
return cueForward(b.size + offset)
default:
b.log.Fatal("should not be called")
b.log.Panic("should not be called")
}

case offsetUncontrolled:
Expand All @@ -790,11 +790,11 @@ func (b *s3Body) Seek(offset int64, whence int) (int64, error) {
case io.SeekEnd:
return cueForward(b.size + offset)
default:
b.log.Fatal("should not be called")
b.log.Panic("should not be called")
}
}

b.log.Fatal("should not be called")
b.log.Panic("should not be called")
return 0, nil
}

Expand Down

0 comments on commit 4637e9e

Please sign in to comment.