aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/format/json.lux
diff options
context:
space:
mode:
authorEduardo Julian2018-12-15 18:32:31 -0400
committerEduardo Julian2018-12-15 18:32:31 -0400
commitee0c268d2e7922ce4d1b1b11291e6858977cce74 (patch)
treee8dcd01dd4b07727f79892278d146403d56a16fe /stdlib/source/lux/data/format/json.lux
parent5f7896ac2cfa8cc9b3ca79c922438412e440a922 (diff)
Re-named the "Error" tag to "Failure".
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/data/format/json.lux30
1 files changed, 15 insertions, 15 deletions
diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux
index 63075804e..7d2e90270 100644
--- a/stdlib/source/lux/data/format/json.lux
+++ b/stdlib/source/lux/data/format/json.lux
@@ -102,7 +102,7 @@
(#error.Success (dictionary.keys obj))
_
- (#error.Error ($_ text/compose "Cannot get the fields of a non-object."))))
+ (#error.Failure ($_ text/compose "Cannot get the fields of a non-object."))))
(def: #export (get key json)
{#.doc "A JSON object field getter."}
@@ -114,10 +114,10 @@
(#error.Success value)
#.None
- (#error.Error ($_ text/compose "Missing field '" key "' on object.")))
+ (#error.Failure ($_ text/compose "Missing field '" key "' on object.")))
_
- (#error.Error ($_ text/compose "Cannot get field '" key "' of a non-object."))))
+ (#error.Failure ($_ text/compose "Cannot get field '" key "' of a non-object."))))
(def: #export (set key value json)
{#.doc "A JSON object field setter."}
@@ -127,7 +127,7 @@
(#error.Success (#Object (dictionary.put key value obj)))
_
- (#error.Error ($_ text/compose "Cannot set field '" key "' of a non-object."))))
+ (#error.Failure ($_ text/compose "Cannot set field '" key "' of a non-object."))))
(do-template [<name> <tag> <type> <desc>]
[(def: #export (<name> key json)
@@ -138,10 +138,10 @@
(#error.Success value)
(#error.Success _)
- (#error.Error ($_ text/compose "Wrong value type at key: " key))
+ (#error.Failure ($_ text/compose "Wrong value type at key: " key))
- (#error.Error error)
- (#error.Error error)))]
+ (#error.Failure error)
+ (#error.Failure error)))]
[get-boolean #Boolean Boolean "booleans"]
[get-number #Number Number "numbers"]
@@ -258,13 +258,13 @@
_
(ex.throw unconsumed-input remainder))
- (#error.Error error)
- (#error.Error error)))
+ (#error.Failure error)
+ (#error.Failure error)))
(def: #export (fail error)
(All [a] (-> Text (Reader a)))
(function (_ inputs)
- (#error.Error error)))
+ (#error.Failure error)))
(def: #export any
{#.doc "Just returns the JSON input without applying any logic."}
@@ -342,7 +342,7 @@
(case head
(#Array values)
(case (p.run (row.to-list values) parser)
- (#error.Error error)
+ (#error.Failure error)
(fail error)
(#error.Success [remainder output])
@@ -369,7 +369,7 @@
(list (#String key) value)))
list.concat)
parser)
- (#error.Error error)
+ (#error.Failure error)
(fail error)
(#error.Success [remainder output])
@@ -397,8 +397,8 @@
(#error.Success [inputs'' _])
(ex.throw unconsumed-input inputs'')
- (#error.Error error)
- (#error.Error error))
+ (#error.Failure error)
+ (#error.Failure error))
(do error.Monad<Error>
[[inputs'' output] (recur inputs')]
(wrap [(list& (#String key) value inputs'')
@@ -459,7 +459,7 @@
offset (l.many l.decimal)]
(wrap ($_ text/compose mark (if signed?' "-" "") offset))))]
(case (frac/decode ($_ text/compose (if signed? "-" "") digits "." decimals exp))
- (#error.Error message)
+ (#error.Failure message)
(p.fail message)
(#error.Success value)