hgweb: add error template to json so it won't crash
authorYuya Nishihara <yuya@tcha.org>
Fri, 07 Sep 2018 22:19:28 +0900
changeset 39486 1a786fe069b8
parent 39485 6772cf74ff6f
child 39487 17ca967e9fca
hgweb: add error template to json so it won't crash
mercurial/templates/json/map
tests/test-hgweb-json.t
--- a/mercurial/templates/json/map	Fri Sep 07 22:12:46 2018 +0900
+++ b/mercurial/templates/json/map	Fri Sep 07 22:19:28 2018 +0900
@@ -241,3 +241,6 @@
   "lastchange": {lastchange|json},
   "labels": {labels|json}
   }'
+error = '\{
+  "error": {error|utf8|json}
+  }'
--- a/tests/test-hgweb-json.t	Fri Sep 07 22:12:46 2018 +0900
+++ b/tests/test-hgweb-json.t	Fri Sep 07 22:19:28 2018 +0900
@@ -2183,6 +2183,16 @@
     "topic": "phases"
   }
 
+Error page shouldn't crash
+
+  $ request json-changeset/deadbeef
+  404 Not Found
+  
+  {
+    "error": "unknown revision 'deadbeef'"
+  }
+  [1]
+
 Commit message with Japanese Kanji 'Noh', which ends with '\x5c'
 
   $ echo foo >> da/foo