File: err.go

package info (click to toggle)
ipp-usb 0.9.30-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 756 kB
  • sloc: sh: 80; makefile: 40
file content (38 lines) | stat: -rw-r--r-- 1,048 bytes parent folder | download
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
}