nanomsg.org/go/mangos/v2@v2.0.9-0.20200203084354-8a092611e461/errors/errors.go (about) 1 // Copyright 2018 The Mangos Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use file except in compliance with the License. 5 // You may obtain a copy of the license at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Package errors just defines some constant error codes, and is intended 16 // to be directly imported. It is safe to import using ".", so that 17 // short names can be used without concern about unrelated namespace 18 // pollution. 19 package errors 20 21 type err string 22 23 func (e err) Error() string { 24 return string(e) 25 } 26 27 // Predefined error values. 28 const ( 29 ErrBadAddr = err("invalid address") 30 ErrBadHeader = err("invalid header received") 31 ErrBadVersion = err("invalid protocol version") 32 ErrTooShort = err("message is too short") 33 ErrTooLong = err("message is too long") 34 ErrClosed = err("object closed") 35 ErrConnRefused = err("connection refused") 36 ErrSendTimeout = err("send time out") 37 ErrRecvTimeout = err("receive time out") 38 ErrProtoState = err("incorrect protocol state") 39 ErrProtoOp = err("invalid operation for protocol") 40 ErrBadTran = err("invalid or unsupported transport") 41 ErrBadProto = err("invalid or unsupported protocol") 42 ErrBadOption = err("invalid or unsupported option") 43 ErrBadValue = err("invalid option value") 44 ErrGarbled = err("message garbled") 45 ErrAddrInUse = err("address in use") 46 ErrBadProperty = err("invalid property name") 47 ErrTLSNoConfig = err("missing TLS configuration") 48 ErrTLSNoCert = err("missing TLS certificates") 49 ErrNotRaw = err("socket not raw") 50 ErrCanceled = err("operation canceled") 51 ErrNoContext = err("protocol does not support contexts") 52 )