Skip to content

请求错误信息中加入reqid #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2014
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions qiniu/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ def call_with(self, path, body, content_type=None, content_length=None):

if resp.status / 100 != 2:
err_msg = ret if "error" not in ret else ret["error"]
reqid = resp.getheader("X-Reqid", None)
detail = resp.getheader("x-log", None)
if reqid is not None:
err_msg += ", reqid:%s" % reqid
if detail is not None:
err_msg += ", detail:%s" % detail

Expand Down
6 changes: 6 additions & 0 deletions qiniu/test/io_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ def test_put_crc_fail(self):
ret, err = io.put(policy.token(), key, data, extra)
assert err is not None

def test_put_fail_reqid(self):
key = "test_%s" % r(9)
data = "hello bubby!"
ret, err = io.put("", key, data, extra)
assert "reqid" in err


class Test_get_file_crc32(unittest.TestCase):

Expand Down