提交 807ffb91 作者: Lars Gierth

commands/dns: return NotFound error for failed resolutions

License: MIT
Signed-off-by: 's avatarLars Gierth <larsg@systemli.org>
上级 9e4800d4
......@@ -17,6 +17,7 @@ type ErrorType uint
const (
ErrNormal ErrorType = iota // general errors
ErrClient // error was caused by the client, (e.g. invalid CLI usage)
ErrNotFound // == HTTP 404 Not Found
ErrImplementation // programmer error in the server
// TODO: add more types of errors for better error-specific handling
)
......
......@@ -60,6 +60,10 @@ The resolver can recursively resolve:
depth = namesys.DefaultDepthLimit
}
output, err := resolver.ResolveN(req.Context(), name, depth)
if err == namesys.ErrResolveFailed {
res.SetError(err, cmds.ErrNotFound)
return
}
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论