2022-11-17 11:02:26 +00:00
|
|
|
/*
|
|
|
|
Copyright 2022 Dolysis Consulting Limited
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
|
|
|
|
For changes see the git log
|
|
|
|
*/
|
2019-03-17 12:40:08 +00:00
|
|
|
package ipp
|
|
|
|
|
2020-03-27 15:38:12 +00:00
|
|
|
import "fmt"
|
|
|
|
|
2020-03-27 23:27:56 +00:00
|
|
|
// IsNotExistsError checks a given error whether a printer or class does not exist
|
2019-03-17 12:40:08 +00:00
|
|
|
func IsNotExistsError(err error) bool {
|
|
|
|
if err == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
return err.Error() == "The printer or class does not exist."
|
|
|
|
}
|
2020-03-27 15:38:12 +00:00
|
|
|
|
2020-03-27 23:27:56 +00:00
|
|
|
// IPPError used for non ok ipp status codes
|
2020-03-27 15:38:12 +00:00
|
|
|
type IPPError struct {
|
|
|
|
Status int16
|
|
|
|
Message string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e IPPError) Error() string {
|
|
|
|
return fmt.Sprintf("ipp status: %d, message: %s", e.Status, e.Message)
|
|
|
|
}
|
|
|
|
|
2020-03-27 23:27:56 +00:00
|
|
|
// HTTPError used for non 200 http codes
|
2020-03-27 15:38:12 +00:00
|
|
|
type HTTPError struct {
|
|
|
|
Code int
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e HTTPError) Error() string {
|
|
|
|
return fmt.Sprintf("got http code %d", e.Code)
|
|
|
|
}
|