Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Performs a DNS standard query to the nameservers specified by the `new` method,
and returns all the answer records in an array-like Lua table. In case of errors, it will
return `nil` and a string describing the error instead.

If the server returns a non-zero error code, the fields `errcode` and `errstr` will be set accordingly in the Lua table returned.
If the server returns a non-zero error code, the fields `errcode` and `errstr` will be set accordingly in the `answers` Lua table that is returned.

Each entry in the `answers` returned table value is also a hash-like Lua table
which usually takes some of the following fields:
Expand Down Expand Up @@ -237,6 +237,10 @@ Here is an example:
ngx.say("failed to query: ", err)
return
end
if ans.errcode then
ngx.say("server returned the error state: ", ans.errcode, ans.errstr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem correct; errcode and errstr will be concatenated together without spacing or anything helping to distinguish them.

return
end

local cjson = require "cjson"
ngx.say("records: ", cjson.encode(ans))
Expand Down