mirror of
https://github.com/bitmagnet-io/bitmagnet.git
synced 2026-05-06 04:16:44 -04:00
c16f76130c
The classifier has been re-implemented and now uses a DSL allowing for full customisation. Several bugs have also been fixed. - Closes https://github.com/bitmagnet-io/bitmagnet/issues/182 - Closes https://github.com/bitmagnet-io/bitmagnet/issues/70 - Closes https://github.com/bitmagnet-io/bitmagnet/issues/68 - Hopefully fixes https://github.com/bitmagnet-io/bitmagnet/issues/126
49 lines
731 B
Go
49 lines
731 B
Go
package classification
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
type Error interface {
|
|
error
|
|
Key() string
|
|
}
|
|
|
|
type WorkflowError struct {
|
|
key string
|
|
message string
|
|
}
|
|
|
|
func (e WorkflowError) Error() string {
|
|
if e.message != "" {
|
|
return e.message
|
|
}
|
|
return fmt.Sprintf("workflow unmarshalError: %s", e.key)
|
|
}
|
|
|
|
func (e WorkflowError) Key() string {
|
|
return e.key
|
|
}
|
|
|
|
var ErrUnmatched = WorkflowError{
|
|
key: "unmatched",
|
|
}
|
|
|
|
var ErrDeleteTorrent = WorkflowError{
|
|
key: "delete_torrent",
|
|
}
|
|
|
|
type RuntimeError struct {
|
|
Path []string
|
|
Cause error
|
|
}
|
|
|
|
func (e RuntimeError) Error() string {
|
|
return fmt.Sprintf("runtime error at Path %s: %s", strings.Join(e.Path, "."), e.Cause)
|
|
}
|
|
|
|
func (e RuntimeError) Unwrap() error {
|
|
return e.Cause
|
|
}
|