-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patherror-formatting.html
More file actions
421 lines (367 loc) · 19.6 KB
/
error-formatting.html
File metadata and controls
421 lines (367 loc) · 19.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width">
<title>Error Formatting - XAG Ledger Dev Portal</title>
<!-- favicon -->
<link rel="apple-touch-icon" sizes="180x180" href="assets/favicons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="16x16" href="assets/favicons/favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="assets/favicons/favicon-32x32.png">
<link rel="manifest" href="assets/favicons/site.webmanifest">
<link rel="shortcut icon" href="favicon.ico">
<meta name="msapplication-TileColor" content="#25A768">
<meta name="msapplication-config" content="assets/favicons/browserconfig.xml">
<meta name="theme-color" content="#25A768">
<!-- jQuery -->
<script src="assets/vendor/jquery-1.11.1.min.js"></script>
<!-- Stylesheet -->
<link href="assets/css/devportal.css" rel="stylesheet" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" />
<!-- syntax highlighting -->
<link rel="stylesheet" href="assets/vendor/docco.min.css" />
<script src="assets/vendor/highlight.min.js"></script>
<!-- expandable code samples -->
<script src="assets/js/expandcode.js"></script>
<!-- multi-code selection tabs -->
<script src="assets/js/multicodetab.js"></script>
<script>
$(document).ready(function() {
$(".multicode").minitabs();
hljs.initHighlighting();
make_code_expandable();
});
</script>
</head>
<body class="xrp-ledger-dev-portal sidebar-primary lang-en ">
<nav class="navbar fixed-top navbar-expand-lg navbar-light bg-white">
<a href="index.html" class="navbar-brand"><img src="assets/img/logo.png" class="logo" height="44" alt="XAG Ledger Dev Portal" /></a>
<button class="navbar-toggler" type="button" data-toggle="slide-collapse" data-target="#navbarHolder" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarHolder">
<ul class="nav navbar-nav">
<li class="nav-item">
<a class="nav-link" href="dev-tools.html">Dev Tools</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://xagfans.com/" target="blank">BBS</a>
</li>
</ul>
<div class="nav navbar-nav language-selector">
<div class="dropdown">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" id="language_selector_header_btn" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
English
</button>
<div class="dropdown-menu" aria-labelledby="language_selector_header_btn">
<a class="dropdown-item" href="/error-formatting.html">English</a>
<a class="dropdown-item" href="/cn/error-formatting.html">中文版</a>
</div><!--/.dropdown-menu-->
</div><!--/.dropdown-->
</div><!--/.language-selector-->
</div><!--/#navbarHolder-->
<div class="menu-overlay"></div>
</nav>
<div class="container-fluid" role="document" id="main_content_wrapper">
<div class="row">
<!-- Right sidebar first so it's at the beginning for mobile layouts -->
<aside class="right-sidebar col-lg-3 order-lg-4 p-0" role="complementary">
<div class="card" id="page-toc-wrapper">
<div class="card-header">
<h4>In this document</h4>
</div>
<ul class="card-body">
<li class="level-1"><a href="#error-formatting">Error Formatting</a></li>
<li class="level-2"><a href="#websocket-format">WebSocket Format</a></li>
<li class="level-2"><a href="#json-rpc-format">JSON-RPC Format</a></li>
<li class="level-2"><a href="#universal-errors">Universal Errors</a></li>
</ul>
</div>
</aside>
<!-- main column -->
<main class="main col-md-7 col-lg-6 order-md-3 " role="main" id="main_content_body">
<nav class="breadcrumbs-wrap p-0 p-md-3" aria-label="breadcrumb">
<ul class="breadcrumb bg-white">
<li class="breadcrumb-item"><a href="index.html">Home</a></li>
<li class="active breadcrumb-item"><a href="docs.html">Docs</a></li>
<li class="active breadcrumb-item"><a href="references.html">References</a></li>
<li class="active breadcrumb-item"><a href="rippled-api.html">rippled API Reference</a></li>
<li class="active breadcrumb-item"><a href="api-conventions.html">API Conventions</a></li>
<li class="active breadcrumb-item">Error Formatting</li>
</ul>
</nav><!--/.breadcrumbs-wrap--> <article class="pt-3 p-md-3">
<div class="content">
<h1 id="error-formatting">Error Formatting</h1>
<p>It is impossible to list all the possible ways an error can occur. Some may occur in the transport layer (for example, loss of network connectivity), in which case the results vary depending on what client and transport you are using. However, if the <code>rippled</code> server successfully receives your request, it tries to respond in a standardized error format.</p>
<p class="devportal-callout caution"><strong>Caution:</strong> When your request results in an error, the entire request is copied back as part of the response, so that you can try to debug the error. However, this also includes any secrets that were passed as part of the request. When sharing error messages, be very careful not to accidentally expose important account secrets to others.</p>
<p>Some example errors:</p>
<div class="multicode" id="code-0"><ul class="codetabs"><li><a href="#code-0-0">WebSocket</a></li><li><a href="#code-0-1">JSON-RPC</a></li><li><a href="#code-0-2">Commandline</a></li></ul>
<div class="code_sample" id="code-0-0" style="position: static;"><pre><code class="json">{
"id": 3,
"status": "error",
"type": "response",
"error": "ledgerIndexMalformed",
"request": {
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"command": "account_info",
"id": 3,
"ledger_index": "-",
"strict": true
}
}
</code></pre></div>
<div class="code_sample" id="code-0-1" style="position: static;"><pre><code class="json">HTTP Status: 200 OK
{
"result": {
"error": "ledgerIndexMalformed",
"request": {
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"command": "account_info",
"ledger_index": "-",
"strict": true
},
"status": "error"
}
}
</code></pre></div>
<div class="code_sample" id="code-0-2" style="position: static;"><pre><code class="json">{
"result": {
"error": "ledgerIndexMalformed",
"request": {
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"command": "account_info",
"ledger_index": "-",
"strict": true
},
"status": "error"
}
}
</code></pre></div>
</div>
<h2 id="websocket-format">WebSocket Format</h2>
<table>
<thead>
<tr>
<th align="left"><code>Field</code></th>
<th align="left">Type</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><code>id</code></td>
<td align="left">(Varies)</td>
<td align="left">ID provided in the Web Socket request that prompted this response</td>
</tr>
<tr>
<td align="left"><code>status</code></td>
<td align="left">String</td>
<td align="left"><code>"error"</code> if the request caused an error</td>
</tr>
<tr>
<td align="left"><code>type</code></td>
<td align="left">String</td>
<td align="left">Typically <code>"response"</code>, which indicates a successful response to a command.</td>
</tr>
<tr>
<td align="left"><code>error</code></td>
<td align="left">String</td>
<td align="left">A unique code for the type of error that occurred</td>
</tr>
<tr>
<td align="left"><code>request</code></td>
<td align="left">Object</td>
<td align="left">A copy of the request that prompted this error, in JSON format. <strong>Caution:</strong> If the request contained any secrets, they are copied here!</td>
</tr>
<tr>
<td align="left"><code>api_version</code></td>
<td align="left">Number</td>
<td align="left"><em>(May be omitted)</em> The <code>api_version</code> specified in the request, if any.</td>
</tr>
</tbody>
</table>
<h2 id="json-rpc-format">JSON-RPC Format</h2>
<p>Some JSON-RPC request respond with an error code on the HTTP layer. In these cases, the response is a plain-text explanation in the response body. For example, if you forgot to specify the command in the <code>method</code> parameter, the response is like this:</p>
<pre><code>HTTP Status: 400 Bad Request
Null method
</code></pre>
<p>For other errors that returned with HTTP status code 200 OK, the responses are formatted in JSON, with the following fields:</p>
<table>
<thead>
<tr>
<th align="left"><code>Field</code></th>
<th align="left">Type</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><code>result</code></td>
<td align="left">Object</td>
<td align="left">Object containing the response to the query</td>
</tr>
<tr>
<td align="left"><code>result.error</code></td>
<td align="left">String</td>
<td align="left">A unique code for the type of error that occurred</td>
</tr>
<tr>
<td align="left"><code>result.status</code></td>
<td align="left">String</td>
<td align="left"><code>"error"</code> if the request caused an error</td>
</tr>
<tr>
<td align="left"><code>result.request</code></td>
<td align="left">Object</td>
<td align="left">A copy of the request that prompted this error, in JSON format. <strong>Caution:</strong> If the request contained any account secrets, they are copied here! <strong>Note:</strong> The request is re-formatted in WebSocket format, regardless of the request made.</td>
</tr>
</tbody>
</table>
<h2 id="universal-errors">Universal Errors</h2>
<p>All methods can potentially return any of the following values for the <code>error</code> code:</p>
<ul>
<li><code>amendmentBlocked</code> - The server is <a href="amendments.html#amendment-blocked">amendment blocked</a> and needs to be updated to the latest version to stay synced with the XAG Ledger network.</li>
<li><code>invalid_API_version</code> - The server does not support the <a href="request-formatting.html#api-versioning">API version number</a> from the request.</li>
<li><code>jsonInvalid</code> - (WebSocket only) The request is not a proper JSON object.<ul>
<li>JSON-RPC returns a 400 Bad Request HTTP error in this case instead.</li>
</ul>
</li>
<li><code>missingCommand</code> - (WebSocket only) The request did not specify a <code>command</code> field.<ul>
<li>JSON-RPC returns a 400 Bad Request HTTP error in this case instead.</li>
</ul>
</li>
<li><code>noClosed</code> - The server does not have a closed ledger, typically because it has not finished starting up.</li>
<li><code>noCurrent</code> - The server does not know what the current ledger is, due to high load, network problems, validator failures, incorrect configuration, or some other problem.</li>
<li><code>noNetwork</code> - The server is having trouble connecting to the rest of the XAG Ledger peer-to-peer network (and is not running in stand-alone mode).</li>
<li><code>tooBusy</code> - The server is under too much load to do this command right now. Generally not returned if you are connected as an admin.</li>
<li><code>unknownCmd</code> - The request does not contain a <a href="rippled-api.html">command</a> that the <code>rippled</code> server recognizes.</li>
<li><code>wsTextRequired</code> - (WebSocket only) The request's <a class="external-link" href="https://tools.ietf.org/html/rfc6455#section-5.2" target="_blank">opcode <i aria-hidden="true" class="fa fa-external-link"></i></a> is not text.</li>
</ul>
</div>
</article>
</main>
<!-- Left sidebar last so it's at the end for mobile -->
<aside class="sidebar col-md-5 col-lg-3 p-0 order-md-1" role="complementary">
<div class="tree_nav">
<!---->
<div class="sidenav_parent">
<a href="rippled-api.html"> rippled API Reference</a>
</div>
<!---->
<!---->
<div id="sidenav" role="tablist" aria-multiselectable="true">
<div class="card active">
<div class="card-header" role="tab" id="sidenav_cat_head_14">
<a class="sidenav_cat_toggler" role="button" data-toggle="collapse" href="#sidenav_collapse_14" aria-expanded="true" aria-controls="sidenav_collapse_14"></a>
<h5 class="card-title">
<a class="sidenav_cat_title active-parent" href="api-conventions.html">API Conventions</a>
</h5>
</div><!-- /.card-header -->
<div id="sidenav_collapse_14" class="collapse show" role="tabpanel" aria-labelledby="sidenav_cat_head_14">
<div class="card-body">
<ul class="sidebar_pagelist">
<li><a class="nosubcat-page" href="basic-data-types.html">Basic Data Types</a></li>
<li><a class="nosubcat-page" href="base58-encodings.html">base58 Encodings</a></li>
<li><a class="nosubcat-page" href="currency-formats.html">Currency Formats</a></li>
<li><a class="active nosubcat-page" href="error-formatting.html">Error Formatting</a></li>
<li><a class="nosubcat-page" href="markers-and-pagination.html">Markers and Pagination</a></li>
<li><a class="nosubcat-page" href="modifying-the-ledger.html">Modifying the Ledger</a></li>
<li><a class="nosubcat-page" href="rate-limiting.html">Rate Limiting</a></li>
<li><a class="nosubcat-page" href="request-formatting.html">Request Formatting</a></li>
<li><a class="nosubcat-page" href="response-formatting.html">Response Formatting</a></li>
<li><a class="nosubcat-page" href="rippled-server-states.html">rippled Server States</a></li>
<li><a class="nosubcat-page" href="serialization.html">Serialization Format</a></li>
</ul>
</div><!-- /.card-body -->
</div><!-- /#sidenav_collapse14 -->
</div><!-- /.panel -->
<div class="card">
<div class="card-header" role="tab" id="sidenav_cat_head_15">
<a class="collapsed sidenav_cat_toggler" role="button" data-toggle="collapse" href="#sidenav_collapse_15" aria-expanded="true" aria-controls="sidenav_collapse_15"></a>
<h5 class="card-title">
<a class="sidenav_cat_title" href="public-rippled-methods.html">Public rippled Methods</a>
</h5>
</div><!-- /.card-header -->
<div id="sidenav_collapse_15" class="collapse" role="tabpanel" aria-labelledby="sidenav_cat_head_15">
<div class="card-body">
<ul class="sidebar_pagelist">
<li><a class="subcat-title" href="account-methods.html">Account Methods</a></li>
<li><a class="subpage" href="account_currencies.html">account_currencies</a></li>
<li><a class="subpage" href="account_info.html">account_info</a></li>
<li><a class="subpage" href="account_lines.html">account_lines</a></li>
<li><a class="subpage" href="account_objects.html">account_objects</a></li>
<li><a class="subpage" href="account_offers.html">account_offers</a></li>
<li><a class="subpage" href="account_tx.html">account_tx</a></li>
<li><a class="subpage" href="gateway_balances.html">gateway_balances</a></li>
<li><a class="subpage" href="noripple_check.html">noripple_check</a></li>
<li><a class="subcat-title" href="ledger-methods.html">Ledger Methods</a></li>
<li><a class="subpage" href="ledger.html">ledger</a></li>
<li><a class="subpage" href="ledger_closed.html">ledger_closed</a></li>
<li><a class="subpage" href="ledger_current.html">ledger_current</a></li>
<li><a class="subpage" href="ledger_data.html">ledger_data</a></li>
<li><a class="subpage" href="ledger_entry.html">ledger_entry</a></li>
<li><a class="subcat-title" href="transaction-methods.html">Transaction Methods</a></li>
<li><a class="subpage" href="sign.html">sign</a></li>
<li><a class="subpage" href="sign_for.html">sign_for</a></li>
<li><a class="subpage" href="submit.html">submit</a></li>
<li><a class="subpage" href="submit_multisigned.html">submit_multisigned</a></li>
<li><a class="subpage" href="transaction_entry.html">transaction_entry</a></li>
<li><a class="subpage" href="tx.html">tx</a></li>
<li><a class="subpage" href="tx_history.html">tx_history</a></li>
<li><a class="subcat-title" href="path-and-order-book-methods.html">Path and Order Book Methods</a></li>
<li><a class="subpage" href="book_offers.html">book_offers</a></li>
<li><a class="subpage" href="deposit_authorized.html">deposit_authorized</a></li>
<li><a class="subpage" href="path_find.html">path_find</a></li>
<li><a class="subpage" href="ripple_path_find.html">ripple_path_find</a></li>
</ul>
</div><!-- /.card-body -->
</div><!-- /#sidenav_collapse15 -->
</div><!-- /.panel -->
</div><!-- /#sidenav -->
</div><!-- /.tree_nav --> </aside>
</div><!--/.row (main layout)-->
</div>
<footer class="xrpl-footer" role="contentinfo">
<section class="container-fluid card-grid card-grid-Nx1">
</section>
<section class="container-fluid p-5 pl-sm-0">
<nav role="navigation" class="d-flex mb-3 language-selector">
<img class="language_selector_icon" src="assets/img/icon-language-selector.svg" width="32" height="40" alt="language selection icon" />
<ul class="nav">
<li class="nav-item">
<a class="nav-link active" href="/error-formatting.html"><i class="fa fa-check-circle"></i> English</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/cn/error-formatting.html">中文</a>
</li>
</ul>
</nav>
<div class="absolute_bottom_footer">
<span>© XAG Ledger Project 2020</span>
</div><!-- /.absolute_bottom_footer -->
</section>
</footer>
<!-- Jump to top button -->
<a href="#main_content_wrapper" class="jump-to-top btn btn-primary btn-lg" role="button" title="Jump to top of page">Top</a>
<script type="text/javascript" src="assets/js/jump-to-top.js"></script>
<!-- Non-blocking resources -->
<!-- Bootstrap JS -->
<script src="assets/vendor/bootstrap.min.js"></script>
<!-- fontawesome icons -->
<link rel="stylesheet" href="assets/vendor/fontawesome/css/font-awesome.min.css" />
<!-- Algolia DocSearch -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
<script type="text/javascript"> docsearch({
apiKey: '70de5b9b8ef95460f3c6e04054b325b2',
indexName: 'xrpl',
inputSelector: '#topsearchbar',
algoliaOptions: { 'facetFilters': ["lang:en"] },
debug: false
});
</script>
<script type="application/javascript">
gtag('set', {'content_group1': 'Content Docs'});
</script>
</body>
</html>