-
Notifications
You must be signed in to change notification settings - Fork 18
/
errors.go
54 lines (43 loc) · 1.16 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Tideland Go Library - Atom Feed
//
// Copyright (C) 2012-2017 Frank Mueller / Tideland / Oldenburg / Germany
//
// All rights reserved. Use of this source code is governed
// by the new BSD license.
package atom
//--------------------
// IMPORTS
//--------------------
import (
"github.com/tideland/golib/errors"
)
//--------------------
// CONSTANTS
//--------------------
// Error codes of the atom feed package.
const (
ErrValidation = iota + 1
ErrParsing
ErrNoPlainText
)
var errorMessages = errors.Messages{
ErrParsing: "cannot parse %s",
ErrNoPlainText: "cannot convert text element %q to plain text",
}
//--------------------
// ERROR CHECKING
//--------------------
// IsValidationError checks if the error signals an invalid feed.
func IsValidationError(err error) bool {
return errors.IsError(err, ErrValidation)
}
// IsParsingError checks if the error signals a bad formatted value.
func IsParsingError(err error) bool {
return errors.IsError(err, ErrParsing)
}
// IsNoPlainTextError checks if the error signals no plain content
// inside a text element.
func IsNoPlainTextError(err error) bool {
return errors.IsError(err, ErrNoPlainText)
}
// EOF