MCPcopy Index your code
hub / github.com/foxcpp/maddy / errorRes

Method errorRes

internal/check/command/command.go:285–330  ·  view source on GitHub ↗
(err error, res module.CheckResult, cmdLine string)

Source from the content-addressed store, hash-verified

283}
284
285func (s *state) errorRes(err error, res module.CheckResult, cmdLine string) module.CheckResult {
286 exitErr, ok := err.(*exec.ExitError)
287 if !ok {
288 res.Reason = &exterrors.SMTPError{
289 Code: 450,
290 Message: "Internal server error",
291 CheckName: "command",
292 Err: err,
293 Misc: map[string]interface{}{
294 "cmd": cmdLine,
295 },
296 }
297 res.Reject = true
298 return res
299 }
300
301 action, ok := s.c.actions[exitErr.ExitCode()]
302 if !ok {
303 res.Reason = &exterrors.SMTPError{
304 Code: 450,
305 Message: "Internal server error",
306 CheckName: "command",
307 Err: err,
308 Reason: "unexpected exit code",
309 Misc: map[string]interface{}{
310 "cmd": cmdLine,
311 "exit_code": exitErr.ExitCode(),
312 },
313 }
314 res.Reject = true
315 return res
316 }
317
318 res.Reason = &exterrors.SMTPError{
319 Code: 550,
320 EnhancedCode: exterrors.EnhancedCode{5, 7, 1},
321 Message: "Message rejected for due to a local policy",
322 CheckName: "command",
323 Misc: map[string]interface{}{
324 "cmd": cmdLine,
325 "exit_code": exitErr.ExitCode(),
326 },
327 }
328
329 return action.Apply(res)
330}
331
332func (s *state) CheckConnection(ctx context.Context) module.CheckResult {
333 if s.c.stage != StageConnection {

Callers 1

runMethod · 0.95

Calls 1

ApplyMethod · 0.45

Tested by

no test coverage detected