diff options
-rw-r--r-- | net/http/server.lua | 2 | ||||
-rw-r--r-- | plugins/mod_s2s.lua | 2 | ||||
-rw-r--r-- | spec/util_error_spec.lua | 14 |
3 files changed, 9 insertions, 9 deletions
diff --git a/net/http/server.lua b/net/http/server.lua index edc6d879..1ef42b2e 100644 --- a/net/http/server.lua +++ b/net/http/server.lua @@ -206,7 +206,7 @@ local function handle_result(request, response, result) end elseif result_type == "string" then body = result; - elseif errors.is_err(result) then + elseif errors.is_error(result) then response.status_code = result.code or 500; body = events.fire_event("http-error", { request = request, response = response, code = result.code or 500, error = result }); elseif promise.is_promise(result) then diff --git a/plugins/mod_s2s.lua b/plugins/mod_s2s.lua index 04fd5bc3..45684f9a 100644 --- a/plugins/mod_s2s.lua +++ b/plugins/mod_s2s.lua @@ -153,7 +153,7 @@ local function bounce_sendq(session, reason) if session.had_stream then -- set when a stream is opened by the remote error_type, condition = "wait", "remote-server-timeout"; end - if errors.is_err(reason) then + if errors.is_error(reason) then error_type, condition, reason_text = reason.type, reason.condition, reason.text; elseif type(reason) == "string" then reason_text = reason; diff --git a/spec/util_error_spec.lua b/spec/util_error_spec.lua index ebe8bff7..cd30ee94 100644 --- a/spec/util_error_spec.lua +++ b/spec/util_error_spec.lua @@ -29,10 +29,10 @@ describe("util.error", function () end); - describe("is_err()", function () + describe("is_error()", function () it("works", function () - assert.truthy(errors.is_err(errors.new())); - assert.falsy(errors.is_err("not an error")); + assert.truthy(errors.is_error(errors.new())); + assert.falsy(errors.is_error("not an error")); end); end); @@ -40,7 +40,7 @@ describe("util.error", function () it("works", function () local ok, err = errors.coerce(nil, "it dun goofed"); assert.is_nil(ok); - assert.truthy(errors.is_err(err)) + assert.truthy(errors.is_error(err)) end); end); @@ -50,7 +50,7 @@ describe("util.error", function () local m = st.message({ type = "chat" }); local e = st.error_reply(m, "modify", "bad-request", nil, "error.example"):tag("extra", { xmlns = "xmpp:example.test" }); local err = errors.from_stanza(e); - assert.truthy(errors.is_err(err)); + assert.truthy(errors.is_error(err)); assert.equal("modify", err.type); assert.equal("bad-request", err.condition); assert.equal(e, err.context.stanza); @@ -187,7 +187,7 @@ describe("util.error", function () end local ok, err = reg.coerce(test()); assert.is_nil(ok); - assert.is_truthy(errors.is_err(err)); + assert.is_truthy(errors.is_error(err)); assert.equal("forbidden", err.condition); end); @@ -208,7 +208,7 @@ describe("util.error", function () end local ok, err = reg.coerce(test()); assert.is_nil(ok); - assert.is_truthy(errors.is_err(err)); + assert.is_truthy(errors.is_error(err)); assert.equal("internal-server-error", err.condition); assert.equal("Oh no", err.text); end); |