-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenhanced_error.go
27 lines (22 loc) · 1006 Bytes
/
enhanced_error.go
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
/*
Package eerror (enhanced error) describes a new type allowing to handle, process and describe enhanced errors in a way every error should be handled.
Errors should always be composed by four major components:
- an identifier ("E_PERMISSIONDENIED"), to filter an error by its kind
- a message (too often considered as sufficient alone for error handling), humanly understandable
- contexts, from wich error was triggered (stacking a new context each time we forward the error)
- attributes, essential for error reproducing purposes
This package ensures the ability to manage errors following this pattern painlessly.
*/
package eerror
/*
Eerror type defines attributes available to build an enhanced error type.
Enhanced errors allows strict error handling, ensure reproducable errors, and understandable error messages from context args.
*/
type Eerror struct {
parent interface{}
identifier string
message string
contexts []string
attributes map[string]interface{}
_instance uint
}