File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ go get github.com/tiendc/go-apperrors
2323
2424- Initializes ` go-apperrors ` at program startup
2525
26- ```
26+ ``` go
2727import gae " github.com/tiendc/go-apperrors"
2828
2929func main () {
@@ -41,7 +41,7 @@ func main() {
4141
4242- Defines your errors
4343
44- ```
44+ ``` go
4545// It is recommended to add a new directory for placing app errors.
4646// In this example, I use `apperrors/errors.go`.
4747
7272
7373- Handles errors in your main processing code
7474
75- ```
75+ ``` go
7676// There are some use cases as below.
7777
7878// 1. You get an unexpected error
@@ -101,7 +101,7 @@ if `user.ID` is not in `project.userIDs` {
101101
102102- Handles validation errors
103103
104- ```
104+ ``` go
105105// Validation is normally performed when you parse requests from client.
106106// You may use an external lib for the validation. That's why you need to make
107107// `adapter` code to transform the validation errors to `AppError`s.
@@ -134,7 +134,7 @@ func (req UpdateProjectReq) Validate() gae.ValidationError {
134134
135135- Handles errors before returning them to client
136136
137- ```
137+ ``` go
138138// In the base handler, implements function `RenderError()`
139139func RenderError (err error , requestWriter Writer ) {
140140 // Gets language from request, you can use util `gae.ParseAcceptLanguage()`
You can’t perform that action at this time.
0 commit comments