bbj/docs/site/errors/index.html

173 lines
7.7 KiB
HTML
Raw Permalink Normal View History

2017-05-04 01:00:32 +00:00
<!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, initial-scale=1.0">
<link rel="shortcut icon" href="../img/favicon.ico">
<title>Errors - BBJ</title>
<link href="../css/bootstrap-custom.min.css" rel="stylesheet">
<link href="../css/font-awesome-4.5.0.css" rel="stylesheet">
<link href="../css/base.css" rel="stylesheet">
<link rel="stylesheet" href="../css/highlight.css">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<script src="../js/jquery-1.10.2.min.js"></script>
<script src="../js/bootstrap-3.0.3.min.js"></script>
<script src="../js/highlight.pack.js"></script>
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<!-- Collapsed navigation -->
<div class="navbar-header">
<!-- Expander button -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="..">BBJ</a>
</div>
<!-- Expanded navigation -->
<div class="navbar-collapse collapse">
<!-- Main navigation -->
<ul class="nav navbar-nav">
<li >
<a href="..">Home</a>
</li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">API <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../api_overview/">Overview & Endpoints</a>
</li>
<li class="active">
<a href="./">Errors</a>
</li>
<li >
<a href="../validation/">Input Validation</a>
</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#" data-toggle="modal" data-target="#mkdocs_search_modal">
<i class="fa fa-search"></i> Search
</a>
</li>
<li >
<a rel="next" href="../api_overview/">
<i class="fa fa-arrow-left"></i> Previous
</a>
</li>
<li >
<a rel="prev" href="../validation/">
Next <i class="fa fa-arrow-right"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="col-md-3"><div class="bs-sidebar hidden-print affix well" role="complementary">
<ul class="nav bs-sidenav">
2017-05-04 02:35:47 +00:00
<li class="main active"><a href="#handling-error-responses">Handling Error Responses</a></li>
2017-05-04 01:00:32 +00:00
</ul>
</div></div>
<div class="col-md-9" role="main">
2017-05-04 02:35:47 +00:00
<h2 id="handling-error-responses">Handling Error Responses</h2>
<p>Errors in BBJ are separated into 6 different codes, to allow easy mapping to
native exception and signaling systems available in the client's programming
language. Errors are all or nothing, there are no "warnings". If a response has
a non-false error field, then data will always be null. An error response from
the api looks like this...</p>
<pre><code class="javascript">{
2017-05-04 01:00:32 +00:00
&quot;error&quot;: {
&quot;code&quot;: // an integer from 0 to 5,
&quot;description&quot;: // a string describing the error in detail.
}
&quot;data&quot;: null // ALWAYS null if error is not false
&quot;usermap&quot;: {} // ALWAYS empty if error is not false
}
</code></pre>
2017-05-04 02:35:47 +00:00
<p>The codes split errors into categories. Some are oriented
2017-05-04 01:00:32 +00:00
to client developers while others should be shown directly to
users.</p>
<ul>
2017-05-04 02:35:47 +00:00
<li>
<p><strong>Code 0</strong>: Malformed but non-empty json input. An empty json input where it is required is handled by code 3. This is just decoding errors. The exception text is returned as description.</p>
</li>
<li>
2022-01-16 03:54:16 +00:00
<p><strong>Code 1</strong>: Internal server error. A short representation of the internal exception as well as the code the server logged it as is returned in the description. Your clients cannot recover from this class of error, and It's probably not your fault if you encounter it. If you ever get one, file a bug report.</p>
2017-05-04 02:35:47 +00:00
</li>
<li>
<p><strong>Code 2</strong>: Server HTTP error: This is similar to the above but captures errors for the HTTP server rather than BBJs own codebase. The description contains the HTTP error code and server description. This notably covers 404s and thus invalid endpoint names. The HTTP error code is left intact, so you may choose to let your HTTP library or tool of choice handle these for you.</p>
</li>
<li>
<p><strong>Code 3</strong>: Parameter error: client sent erroneous input for its method. This could mean missing arguments, type errors, etc. It generalizes errors that should be fixed by the client developer and the returned descriptions are geared to them rather than end users.</p>
</li>
<li>
<p><strong>Code 4</strong>: User error: These errors regard actions that the user has taken that are invalid, but not really errors in a traditional sense. The description field should be shown to users verbatim, in a clear and noticeable fashion. They are formatted as concise English sentences and end with appropriate punctuation marks.</p>
</li>
<li>
<p><strong>Code 5</strong>: Authorization error: This code represents an erroneous User/Auth header pair. This should trigger the user to provide correct credentials or fall back to anon mode.</p>
</li>
2017-05-04 01:00:32 +00:00
</ul></div>
</div>
<footer class="col-md-12">
<hr>
<p>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</p>
</footer>
<script>var base_url = '..';</script>
<script data-main="../mkdocs/js/search.js" src="../mkdocs/js/require.js"></script>
<script src="../js/base.js"></script><div class="modal" id="mkdocs_search_modal" tabindex="-1" role="dialog" aria-labelledby="Search Modal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="exampleModalLabel">Search</h4>
</div>
<div class="modal-body">
<p>
From here you can search these documents. Enter
your search terms below.
</p>
<form role="form">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search..." id="mkdocs-search-query">
</div>
</form>
<div id="mkdocs-search-results"></div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</body>
</html>