You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+69-2Lines changed: 69 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,28 @@
2
2
3
3
## Introduction
4
4
5
-
errog helps to error handling for golang apps.
5
+
errog helps to error handling for golang apps and thanks to golang/plugins it can be added the new plugin
6
+
7
+
The main purpose of this library is to manage all error codes from a common library.
8
+
9
+
10
+
## Example
11
+
12
+
In order to see on example app make commands can be used like below:
13
+
14
+
```shell
15
+
make init
16
+
make example
17
+
```
18
+
19
+
And example app returns like below:
20
+
21
+
Ex App Group is "http" and code is "401"
22
+
23
+
```json
24
+
{"msg":"Although the HTTP standard specifies \"unauthorized\", semantically this response means \"unauthenticated\". That is, the client must authenticate itself to get the requested response."}
25
+
```
26
+
6
27
7
28
8
29
## Usage
@@ -29,6 +50,52 @@ func test() error {
29
50
```
30
51
31
52
32
-
33
53
> [!NOTE]
34
54
> "http" => group | "401" => code of group (For this ex it means http **401** error code.)
55
+
56
+
57
+
## Plugins
58
+
You can create a plugin for errorg. Errorg uses Golang plugins and some plugins created by default. If you want to further information for plugins check [this](https://pkg.go.dev/plugin) out
59
+
60
+
You can add the new plugin to under the **plugins** folder.
}{"The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing)."},
74
+
}
75
+
}
76
+
77
+
varGroup httpError
78
+
```
79
+
80
+
Group represent the interface that will be implemented.
81
+
82
+
After that you need to add new make command to Makefile
83
+
84
+
Ex command:
85
+
86
+
```makefile
87
+
http-plugin: # To build a http errors plugin.
88
+
@echo " > Building http-plugin..."
89
+
chmod -R 700 ${CURDIR}/${PLUGINS_FOLDER}
90
+
CGO_ENABLED=${CGO} GOOS=${OS} GOARCH=${ARCH} go build -buildmode=plugin -o ${CURDIR}/${PLUGINS_FOLDER}/http/${PLUGIN_NAME}${PLUGINS_FOLDER}/http/${PLUGIN_GO_FILE}
91
+
```
92
+
93
+
plugin module waits *.so* files Therefore this command will be created the **plugin.so** file.
94
+
95
+
Lastly, you need to add new plugin infos to configs/config.yaml
0 commit comments