-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy patherr.go
More file actions
38 lines (33 loc) · 1.02 KB
/
err.go
File metadata and controls
38 lines (33 loc) · 1.02 KB
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
/* ipp-usb - HTTP reverse proxy, backed by IPP-over-USB connection to device
*
* Copyright (C) 2020 and up by Alexander Pevzner (pzz@apevzner.com)
* See LICENSE for license terms and conditions
*
* Common errors
*/
package main
import (
"errors"
"io"
"net/url"
)
// Error values for ipp-usb
var (
ErrLockIsBusy = errors.New("Lock is busy")
ErrNoMemory = errors.New("Not enough memory")
ErrShutdown = errors.New("Shutdown requested")
ErrBlackListed = errors.New("Device is blacklisted")
ErrInitTimedOut = errors.New("Device initialization timed out")
ErrUnusable = errors.New("Device doesn't implement print or scan service")
ErrNoIppUsb = errors.New("ipp-usb daemon not running")
ErrAccess = errors.New("Access denied")
ErrPartialInit = errors.New("Some parts of device not ready yet")
)
// ErrIsEOF tells if error is io.EOF, possibly wrapped by
// the Go HTTP client.
func ErrIsEOF(err error) bool {
if urlerr, ok := err.(*url.Error); ok {
return urlerr.Err == io.EOF
}
return err == io.EOF
}