This commit is contained in:
r4
2021-07-28 17:30:01 +02:00
parent 6dfb9bc0b1
commit d2fae31d1a
12 changed files with 1501 additions and 0 deletions

26
ytdl/error.go Normal file
View File

@@ -0,0 +1,26 @@
package ytdl
type Error struct {
// `Input` is the input given to youtube-dl when the error occurred.
// If `Input` is set to "", it is ignored.
Input string
// `Err` is the underlying error.
Err error
}
// `input` may be set to "", in which case it is ignored when outputting the
// error message.
func newError(input string, err error) *Error {
return &Error{
Input: input,
Err: err,
}
}
func (e *Error) Error() string {
if e.Input == "" {
return "ytdl: " + e.Err.Error()
} else {
return "ytdl['" + e.Input + "']: " + e.Err.Error()
}
}