Refine backlog policy and runtime guards
Move speculative framework items into Ideas and bump rc.14 Guard tgapi API/uploader setup and nil plugin registrations Add missing observer Event godoc
This commit is contained in:
@@ -98,6 +98,11 @@ type API struct {
|
||||
// Always call Close() when done to release resources.
|
||||
func NewAPI(opts *APIOpts) *API {
|
||||
l := utils.CreateLogger("API", utils.GetLoggerLevel())
|
||||
if opts == nil {
|
||||
l.Errorln("Set API options")
|
||||
_ = l.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
client := opts.client
|
||||
if client == nil {
|
||||
|
||||
@@ -71,6 +71,11 @@ type Uploader struct {
|
||||
// NewUploader creates a multipart uploader bound to an API client.
|
||||
func NewUploader(api *API) *Uploader {
|
||||
logger := utils.CreateLogger("UPLOADER", utils.GetLoggerLevel())
|
||||
if api == nil {
|
||||
logger.Errorln("api is nil")
|
||||
_ = logger.Close()
|
||||
return nil
|
||||
}
|
||||
return &Uploader{api, logger}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user