File: error.go

package info (click to toggle)
golang-github-neowaylabs-wabbit 0.0~git20210927.0.73ad61d-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, experimental, forky, sid, trixie
  • size: 272 kB
  • sloc: sh: 24; makefile: 4
file content (39 lines) | stat: -rw-r--r-- 549 bytes parent folder | download | duplicates (3)
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
package utils

import "fmt"

type Error struct {
	code    int
	reason  string
	server  bool
	recover bool
}

func NewError(c int, r string, s bool, rc bool) *Error {
	return &Error{
		code:    c,
		reason:  r,
		server:  s,
		recover: rc,
	}
}

func (e Error) Error() string {
	return fmt.Sprintf("Exception (%d) Reason: %q", e.code, e.reason)
}

func (e Error) Code() int {
	return e.code
}

func (e Error) Reason() string {
	return e.reason
}

func (e Error) Server() bool {
	return e.server
}

func (e Error) Recover() bool {
	return e.recover
}