summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-06-03 14:54:06 +0300
committerValery Piashchynski <[email protected]>2021-06-03 14:54:06 +0300
commit62bbde7936109d18bf1f727974719804dad4c105 (patch)
tree54fb8493840837294bbe84ba5e1d7663ed027cad /plugins
parent9c01e7ab1548e1416598b702d63866fa6dc5707b (diff)
- Do not write an error into the responseWriter if this is internal
error - Handle SoftJob error Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/server/plugin.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/server/plugin.go b/plugins/server/plugin.go
index aab9dcde..7f694f3c 100644
--- a/plugins/server/plugin.go
+++ b/plugins/server/plugin.go
@@ -235,6 +235,18 @@ func (server *Plugin) collectEvents(event interface{}) {
if we, ok := event.(events.WorkerEvent); ok {
switch we.Event {
case events.EventWorkerError:
+ switch e := we.Payload.(type) { //nolint:gocritic
+ case error:
+ if errors.Is(errors.SoftJob, e) {
+ // get source error for the softjob error
+ server.log.Error(strings.TrimRight(e.(*errors.Error).Err.Error(), " \n\t"))
+ return
+ }
+
+ // print full error for the other types of errors
+ server.log.Error(strings.TrimRight(e.Error(), " \n\t"))
+ return
+ }
server.log.Error(strings.TrimRight(we.Payload.(error).Error(), " \n\t"))
case events.EventWorkerLog:
server.log.Debug(strings.TrimRight(utils.AsString(we.Payload.([]byte)), " \n\t"))