Comparison

teal-src/util/stanza.d.tl @ 12516:d76ac22f3571

util.stanza: Document error conditions in Teal definition Gets you nice error messages if you make a typo in with error_reply()
author Kim Alvefur <zash@zash.se>
date Tue, 17 May 2022 17:05:15 +0200
parent 11642:7f2dee4249aa
child 12517:a8c17c95ef4d
comparison
equal deleted inserted replaced
12515:76c1725f4467 12516:d76ac22f3571
1 local record lib 1 local record lib
2 2
3 type children_iter = function ( stanza_t ) : stanza_t 3 type children_iter = function ( stanza_t ) : stanza_t
4 type childtags_iter = function () : stanza_t 4 type childtags_iter = function () : stanza_t
5 type maptags_cb = function ( stanza_t ) : stanza_t 5 type maptags_cb = function ( stanza_t ) : stanza_t
6
7
8 enum stanza_error_type
9 "auth"
10 "cancel"
11 "continue"
12 "modify"
13 "wait"
14 end
15 enum stanza_error_condition
16 "bad-request"
17 "conflict"
18 "feature-not-implemented"
19 "forbidden"
20 "gone"
21 "internal-server-error"
22 "item-not-found"
23 "jid-malformed"
24 "not-acceptable"
25 "not-allowed"
26 "not-authorized"
27 "policy-violation"
28 "recipient-unavailable"
29 "redirect"
30 "registration-required"
31 "remote-server-not-found"
32 "remote-server-timeout"
33 "resource-constraint"
34 "service-unavailable"
35 "subscription-required"
36 "undefined-condition"
37 "unexpected-request"
38 end
6 39
7 record stanza_t 40 record stanza_t
8 name : string 41 name : string
9 attr : { string : string } 42 attr : { string : string }
10 { stanza_t | string } 43 { stanza_t | string }
33 66
34 top_tag : function ( stanza_t ) : string 67 top_tag : function ( stanza_t ) : string
35 pretty_print : function ( stanza_t ) : string 68 pretty_print : function ( stanza_t ) : string
36 pretty_top_tag : function ( stanza_t ) : string 69 pretty_top_tag : function ( stanza_t ) : string
37 70
38 get_error : function ( stanza_t ) : string, string, string, stanza_t 71 get_error : function ( stanza_t ) : stanza_error_type, stanza_error_condition, string, stanza_t
39 indent : function ( stanza_t, integer, string ) : stanza_t 72 indent : function ( stanza_t, integer, string ) : stanza_t
40 end 73 end
41 74
42 record serialized_stanza_t 75 record serialized_stanza_t
43 name : string 76 name : string
51 deserialize : function ( serialized_stanza_t ) : stanza_t 84 deserialize : function ( serialized_stanza_t ) : stanza_t
52 clone : function ( stanza_t, boolean ) : stanza_t 85 clone : function ( stanza_t, boolean ) : stanza_t
53 message : function ( { string : string }, string ) : stanza_t 86 message : function ( { string : string }, string ) : stanza_t
54 iq : function ( { string : string } ) : stanza_t 87 iq : function ( { string : string } ) : stanza_t
55 reply : function ( stanza_t ) : stanza_t 88 reply : function ( stanza_t ) : stanza_t
56 error_reply : function ( stanza_t, string, string, string, string ) 89 error_reply : function ( stanza_t, stanza_error_type, stanza_error_condition, string, string ) : stanza_t
57 presence : function ( { string : string } ) : stanza_t 90 presence : function ( { string : string } ) : stanza_t
58 xml_escape : function ( string ) : string 91 xml_escape : function ( string ) : string
59 pretty_print : function ( string ) : string 92 pretty_print : function ( string ) : string
60 end 93 end
61 94