From 2c2931cc51d6b4d50ee7af345c9b6c59dd50fd42 Mon Sep 17 00:00:00 2001 From: Erik Hetzner Date: Tue, 5 Dec 2017 21:25:54 -0800 Subject: [PATCH] Improve error message for bad key --- extension/content/modules/Core.jsm | 2 +- test/test.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/extension/content/modules/Core.jsm b/extension/content/modules/Core.jsm index caabba0..d30181b 100644 --- a/extension/content/modules/Core.jsm +++ b/extension/content/modules/Core.jsm @@ -68,7 +68,7 @@ function item2key(item) { function findByKey(key, zotero) { let rejectIfUndefined = (item)=>{ if (!item) { - return makeClientError('Item not found.'); + return makeClientError(`${key} not found`); } else { return item; } diff --git a/test/test.rb b/test/test.rb index f8d6170..15874bd 100644 --- a/test/test.rb +++ b/test/test.rb @@ -124,6 +124,7 @@ def test_items_easykey_bad assert_equal 400, resp.status assert_equal "doe:2005foobar had no results", resp.body end + def test_betterbibtexkey resp = @client.get(@item_url, {"betterbibtexkey" => "doe:2005first", "format" => "key"}) assert_equal 200, resp.status @@ -182,6 +183,7 @@ def test_items_style_param def test_items_bad_key resp = @client.get(@item_url, {"key" => "1_ZBZQ4KMXXXX", "format" => "key"}) assert_equal 400, resp.status + assert_equal "1_ZBZQ4KMXXXX not found", resp.body end def test_items_multiple_easykeys