1
0

A separate errors.go has no sense.

This commit is contained in:
Alexander Andreev 2023-02-04 20:48:07 +04:00
parent 242fa48358
commit 3de964388a
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F
2 changed files with 3 additions and 11 deletions

View File

@ -2,6 +2,7 @@ package main
import ( import (
"bufio" "bufio"
"errors"
"log" "log"
"os" "os"
"strconv" "strconv"
@ -74,7 +75,7 @@ func (conf *Configuration) StoreConfiguration(path string) (err error) {
func (conf *Configuration) AddProcess(process string, configPath string) error { func (conf *Configuration) AddProcess(process string, configPath string) error {
for _, v := range conf.Processes { for _, v := range conf.Processes {
if v == process { if v == process {
return ErrIsOnList return errors.New("process is already on list")
} }
} }
@ -93,5 +94,5 @@ func (conf *Configuration) RemoveProcess(process string, configPath string) erro
} }
} }
return ErrNotFound return errors.New("process is not on list")
} }

View File

@ -1,9 +0,0 @@
package main
import "errors"
// ErrNotFound occurs when a process is not presented in a list
var ErrNotFound = errors.New("process is not on list")
// ErrIsOnList occurs when a process is already presented in a list
var ErrIsOnList = errors.New("process is already on list")