Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rym-util
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhengqiuyun
rym-util
Commits
b1bdf6c0
Commit
b1bdf6c0
authored
Nov 30, 2022
by
zhengqiuyun86
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
协程执行器
parent
ed2c6efb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
4 deletions
+37
-4
GoroutineExecutor.go
concurrent/GoroutineExecutor/GoroutineExecutor.go
+14
-0
CatchException.go
exception/catch/CatchException.go
+23
-4
No files found.
concurrent/GoroutineExecutor/GoroutineExecutor.go
0 → 100644
View file @
b1bdf6c0
package
GoroutineExecutor
import
(
"git.168cad.top/zhengqiuyun/rym-util/exception/catch"
)
func
do
(
f
func
())
{
defer
catch
.
ExceptionCatch
(
nil
)
f
()
}
func
SynDo
(
f
func
())
{
go
do
(
f
)
}
exception/catch/CatchException.go
View file @
b1bdf6c0
...
@@ -21,17 +21,36 @@ func ExceptionCatch(c *gin.Context) {
...
@@ -21,17 +21,36 @@ func ExceptionCatch(c *gin.Context) {
getWay
.
FailAndMsg
(
c
,
e
.
Code
,
e
.
Err
)
getWay
.
FailAndMsg
(
c
,
e
.
Code
,
e
.
Err
)
}
}
break
break
default
:
case
error
:
e
:=
(
err
)
.
(
error
)
e
:=
(
err
)
.
(
error
)
var
buf
[
1024
]
byte
n
:=
runtime
.
Stack
(
buf
[
:
],
true
)
fmt
.
Println
(
string
(
buf
[
:
]),
n
)
if
c
==
nil
{
if
c
==
nil
{
log
.
Error
(
e
.
Error
())
log
.
Error
(
e
.
Error
())
}
else
{
}
else
{
getWay
.
FailAndMsg
(
c
,
"SYSTEM.ERROR"
,
e
.
Error
())
getWay
.
FailAndMsg
(
c
,
"SYSTEM.ERROR"
,
e
.
Error
())
}
}
printStack
()
break
case
string
:
e
:=
(
err
)
.
(
string
)
if
c
==
nil
{
log
.
Error
(
e
)
}
else
{
getWay
.
FailAndMsg
(
c
,
"SYSTEM.ERROR"
,
e
)
}
printStack
()
break
default
:
if
c
!=
nil
{
getWay
.
FailAndMsg
(
c
,
"SYSTEM.ERROR"
,
"系统繁忙..."
)
}
printStack
()
break
break
}
}
}
}
}
}
func
printStack
()
{
var
buf
[
1024
]
byte
n
:=
runtime
.
Stack
(
buf
[
:
],
true
)
fmt
.
Println
(
string
(
buf
[
:
]),
n
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment