mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
common errors as variable.
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package capture
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
@ -9,6 +8,7 @@ import (
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"demodesk/neko/internal/capture/gst"
|
||||
"demodesk/neko/internal/types"
|
||||
)
|
||||
|
||||
type BroacastManagerCtx struct {
|
||||
@ -67,7 +67,7 @@ func (manager *BroacastManagerCtx) Url() string {
|
||||
|
||||
func (manager *BroacastManagerCtx) createPipeline() error {
|
||||
if manager.pipeline != nil {
|
||||
return fmt.Errorf("pipeline already exists")
|
||||
return types.ErrCapturePipelineAlreadyExists
|
||||
}
|
||||
|
||||
var err error
|
||||
|
@ -1,7 +1,7 @@
|
||||
package capture
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"errors"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
@ -93,12 +93,12 @@ func (manager *ScreencastManagerCtx) Image() ([]byte, error) {
|
||||
case sample := <-manager.sample:
|
||||
return sample.Data, nil
|
||||
case <-time.After(1 * time.Second):
|
||||
return nil, fmt.Errorf("timeouted")
|
||||
return nil, errors.New("timeouted")
|
||||
}
|
||||
}
|
||||
|
||||
if manager.image.Data == nil {
|
||||
return nil, fmt.Errorf("image sample not found")
|
||||
return nil, errors.New("image sample not found")
|
||||
}
|
||||
|
||||
return manager.image.Data, nil
|
||||
@ -109,7 +109,7 @@ func (manager *ScreencastManagerCtx) start() error {
|
||||
defer manager.mu.Unlock()
|
||||
|
||||
if !manager.enabled {
|
||||
return fmt.Errorf("screenshot pipeline not enabled")
|
||||
return errors.New("screenshot pipeline not enabled")
|
||||
}
|
||||
|
||||
err := manager.createPipeline()
|
||||
@ -131,7 +131,7 @@ func (manager *ScreencastManagerCtx) stop() {
|
||||
|
||||
func (manager *ScreencastManagerCtx) createPipeline() error {
|
||||
if manager.pipeline != nil {
|
||||
return fmt.Errorf("pipeline already exists")
|
||||
return types.ErrCapturePipelineAlreadyExists
|
||||
}
|
||||
|
||||
var err error
|
||||
|
@ -1,7 +1,6 @@
|
||||
package capture
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
@ -141,7 +140,7 @@ func (manager *StreamManagerCtx) Started() bool {
|
||||
|
||||
func (manager *StreamManagerCtx) createPipeline() error {
|
||||
if manager.pipeline != nil {
|
||||
return fmt.Errorf("pipeline already exists")
|
||||
return types.ErrCapturePipelineAlreadyExists
|
||||
}
|
||||
|
||||
var err error
|
||||
|
Reference in New Issue
Block a user