<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.appstudio.dev/index.php?action=history&amp;feed=atom&amp;title=Error_handling</id>
	<title>Error handling - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.appstudio.dev/index.php?action=history&amp;feed=atom&amp;title=Error_handling"/>
	<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Error_handling&amp;action=history"/>
	<updated>2026-07-26T07:10:00Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Error_handling&amp;diff=11210&amp;oldid=prev</id>
		<title>Ghenne at 15:25, 25 February 2021</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Error_handling&amp;diff=11210&amp;oldid=prev"/>
		<updated>2021-02-25T15:25:40Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:25, 25 February 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;As much as we&#039;d like to avoid errors, they happen from time to time. When making asynchronous calls using &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Volt&lt;/del&gt;&#039;s [https://docs.voltcloud.io/client/ client library] the callbacks are always of the form: &amp;lt;code&amp;gt;callback(error, data)&amp;lt;/code&amp;gt;. If &amp;lt;code&amp;gt;error&amp;lt;/code&amp;gt; is [https://developer.mozilla.org/en-US/docs/Glossary/Truthy truthy] it means an error has occurred while making your request. Here are some tips for understanding exactly what has gone wrong.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;As much as we&#039;d like to avoid errors, they happen from time to time. When making asynchronous calls using &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;VoltServer&lt;/ins&gt;&#039;s [https://docs.voltcloud.io/client/ client library] the callbacks are always of the form: &amp;lt;code&amp;gt;callback(error, data)&amp;lt;/code&amp;gt;. If &amp;lt;code&amp;gt;error&amp;lt;/code&amp;gt; is [https://developer.mozilla.org/en-US/docs/Glossary/Truthy truthy] it means an error has occurred while making your request. Here are some tips for understanding exactly what has gone wrong.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== The Error Object ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== The Error Object ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l29&quot;&gt;Line 29:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 29:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If the [https://docs.voltcloud.io/api/ &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Volt &lt;/del&gt;API] is reachable and responds with an error, an additional parameter is added to the error object: &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;. If &amp;lt;code&amp;gt;error.status&amp;lt;/code&amp;gt; is defined, it will be set to the HTTP status code returned by the API. This value can be useful for debugging or logging.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If the [https://docs.voltcloud.io/api/ &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;VoltServer &lt;/ins&gt;API] is reachable and responds with an error, an additional parameter is added to the error object: &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;. If &amp;lt;code&amp;gt;error.status&amp;lt;/code&amp;gt; is defined, it will be set to the HTTP status code returned by the API. This value can be useful for debugging or logging.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== The Data Object ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== The Data Object ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For nearly all API errors, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Volt &lt;/del&gt;returns an additional data object that gives you more specific information about what has caused the error. At a minimum that object will be of this form:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For nearly all API errors, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;VoltServer &lt;/ins&gt;returns an additional data object that gives you more specific information about what has caused the error. At a minimum that object will be of this form:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l76&quot;&gt;Line 76:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 76:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Extended Error Data ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Extended Error Data ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Certain types of &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Volt &lt;/del&gt;errors include additional information in their data object.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Certain types of &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;VoltServer &lt;/ins&gt;errors include additional information in their data object.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== ValidationError ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== ValidationError ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key nsbasic_mediawiki1348787612:diff:1.41:old-9220:rev-11210:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Ghenne</name></author>
	</entry>
	<entry>
		<id>https://wiki.appstudio.dev/index.php?title=Error_handling&amp;diff=9220&amp;oldid=prev</id>
		<title>Sarah: Instructions on handling various types of errors.</title>
		<link rel="alternate" type="text/html" href="https://wiki.appstudio.dev/index.php?title=Error_handling&amp;diff=9220&amp;oldid=prev"/>
		<updated>2017-05-26T18:12:34Z</updated>

		<summary type="html">&lt;p&gt;Instructions on handling various types of errors.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;As much as we&amp;#039;d like to avoid errors, they happen from time to time. When making asynchronous calls using Volt&amp;#039;s [https://docs.voltcloud.io/client/ client library] the callbacks are always of the form: &amp;lt;code&amp;gt;callback(error, data)&amp;lt;/code&amp;gt;. If &amp;lt;code&amp;gt;error&amp;lt;/code&amp;gt; is [https://developer.mozilla.org/en-US/docs/Glossary/Truthy truthy] it means an error has occurred while making your request. Here are some tips for understanding exactly what has gone wrong.&lt;br /&gt;
&lt;br /&gt;
== The Error Object ==&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ll start by taking a look at the &amp;lt;code&amp;gt;error&amp;lt;/code&amp;gt; parameter of the callback. If an error has occurred, it will be a standard [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error JavaScript Error] object.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;error&amp;lt;/code&amp;gt; parameter is always guaranteed to have a &amp;lt;code&amp;gt;message&amp;lt;/code&amp;gt; attribute. In the case of network timeouts and errors, this will be the only attribute set. You might consider using an alert to display this message to the user:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;syntaxhighlight lang=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
  $volt.user.get(function (error, data) {&lt;br /&gt;
    if (error) {&lt;br /&gt;
      alert(error.message);&lt;br /&gt;
    } else {&lt;br /&gt;
      alert(&amp;#039;Success!&amp;#039;);&lt;br /&gt;
    }&lt;br /&gt;
  });&lt;br /&gt;
  &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;syntaxhighlight lang=&amp;quot;basic&amp;quot;&amp;gt;&lt;br /&gt;
  Function userCallback(error, data)&lt;br /&gt;
    If error Then&lt;br /&gt;
      alert(error.message)&lt;br /&gt;
    Else&lt;br /&gt;
      alert(&amp;quot;Success!&amp;quot;)&lt;br /&gt;
    End If&lt;br /&gt;
  End Function&lt;br /&gt;
&lt;br /&gt;
  $volt.user.get(userCallback)&lt;br /&gt;
  &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the [https://docs.voltcloud.io/api/ Volt API] is reachable and responds with an error, an additional parameter is added to the error object: &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;. If &amp;lt;code&amp;gt;error.status&amp;lt;/code&amp;gt; is defined, it will be set to the HTTP status code returned by the API. This value can be useful for debugging or logging.&lt;br /&gt;
&lt;br /&gt;
== The Data Object ==&lt;br /&gt;
&lt;br /&gt;
For nearly all API errors, Volt returns an additional data object that gives you more specific information about what has caused the error. At a minimum that object will be of this form:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
  {&lt;br /&gt;
    &amp;quot;type&amp;quot;: &amp;quot;VoltError&amp;quot;,&lt;br /&gt;
    &amp;quot;message&amp;quot;: &amp;quot;Detailed description of the error.&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Generally &amp;lt;code&amp;gt;data.message&amp;lt;/code&amp;gt; can be useful to display to an end user whereas &amp;lt;code&amp;gt;data.type&amp;lt;/code&amp;gt; is useful for debugging or logging. We can modify our code above to display &amp;lt;code&amp;gt;data.message&amp;lt;/code&amp;gt; if it&amp;#039;s available:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;syntaxhighlight lang=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;br /&gt;
  $volt.user.get(function (error, data) {&lt;br /&gt;
    if (error) {&lt;br /&gt;
      if (data) {&lt;br /&gt;
        alert(data.message);&lt;br /&gt;
      } else {&lt;br /&gt;
        alert(error.message);&lt;br /&gt;
      }&lt;br /&gt;
    } else {&lt;br /&gt;
      alert(&amp;#039;Success!&amp;#039;);&lt;br /&gt;
    }&lt;br /&gt;
  });&lt;br /&gt;
  &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;syntaxhighlight lang=&amp;quot;basic&amp;quot;&amp;gt;&lt;br /&gt;
  Function userCallback(error, data)&lt;br /&gt;
    If error Then&lt;br /&gt;
      If data Then&lt;br /&gt;
        alert(data.message)&lt;br /&gt;
      Else&lt;br /&gt;
        alert(error.message)&lt;br /&gt;
      End If&lt;br /&gt;
    Else&lt;br /&gt;
      alert(&amp;quot;Success!&amp;quot;)&lt;br /&gt;
    End If&lt;br /&gt;
  End Function&lt;br /&gt;
&lt;br /&gt;
  $volt.user.get(userCallback)&lt;br /&gt;
  &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Extended Error Data ==&lt;br /&gt;
&lt;br /&gt;
Certain types of Volt errors include additional information in their data object.&lt;br /&gt;
&lt;br /&gt;
=== ValidationError ===&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;ValidationError&amp;lt;/code&amp;gt; occurs when the data you&amp;#039;ve passed in your request is invalid in some way. It may include an additional attribute: &amp;lt;code&amp;gt;validations&amp;lt;/code&amp;gt;. If &amp;lt;code&amp;gt;validations&amp;lt;/code&amp;gt; it truthy, it will be either in the form of a general validation, or a password validation.&lt;br /&gt;
&lt;br /&gt;
==== General Validation Errors ====&lt;br /&gt;
&lt;br /&gt;
For general validation errors, &amp;lt;code&amp;gt;error.validations.body&amp;lt;/code&amp;gt; will be an object of the following form:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
  {&lt;br /&gt;
    &amp;quot;body&amp;quot;: [&lt;br /&gt;
      {&lt;br /&gt;
        &amp;quot;value&amp;quot;: &amp;quot;notanemail&amp;quot;,&lt;br /&gt;
        &amp;quot;property&amp;quot;: &amp;quot;request.body.email&amp;quot;,&lt;br /&gt;
        &amp;quot;messages&amp;quot;: [&lt;br /&gt;
          &amp;quot;does not conform to the \&amp;quot;email\&amp;quot; format&amp;quot;&lt;br /&gt;
        ]&lt;br /&gt;
      },&lt;br /&gt;
      {&lt;br /&gt;
        &amp;quot;property&amp;quot;: &amp;quot;request.body&amp;quot;,&lt;br /&gt;
        &amp;quot;messages&amp;quot;: [&lt;br /&gt;
          &amp;quot;requires property \&amp;quot;password\&amp;quot;&amp;quot;&lt;br /&gt;
        ]&lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above response was generated from the following invalid call: &amp;lt;code&amp;gt;$volt.auth.register(&amp;#039;notanemail, undefined, &amp;#039;does not match&amp;#039;, callback);&amp;lt;c/ode&amp;gt;. If &amp;lt;code&amp;gt;error.validations.body&amp;lt;/code&amp;gt; exists, it will be an array of objects. Each object will have at a minimum &amp;lt;code&amp;gt;property&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;messages&amp;lt;/code&amp;gt; attributes. Some will also have a &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; attribute.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;property&amp;lt;/code&amp;gt; - the property that failed validation. You can ignore the &amp;lt;code&amp;gt;request.body&amp;lt;/code&amp;gt; portion. In the case that the property is exactly equal to &amp;lt;code&amp;gt;request.body&amp;lt;/code&amp;gt; it indicates a problem with the entire request.&lt;br /&gt;
* &amp;lt;code&amp;gt;messages&amp;lt;/code&amp;gt; - an array of messages describing why validation failed.&lt;br /&gt;
* &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; - the value that failed validation, if applicable.&lt;br /&gt;
&lt;br /&gt;
Generally, you will want to perform client side validation and not depend on only server side validation. However, the above data structure can provide valuable insight into why your requests are failing.&lt;br /&gt;
&lt;br /&gt;
==== Password Validation Errors ====&lt;br /&gt;
&lt;br /&gt;
For invalid passwords, &amp;lt;code&amp;gt;error.validations.password&amp;lt;/code&amp;gt; is an array of messages indicating which validations were failed by the password:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
  {&lt;br /&gt;
    &amp;quot;password&amp;quot;: [&lt;br /&gt;
      &amp;quot;The password must be at least 10 characters long.&amp;quot;,&lt;br /&gt;
      &amp;quot;The password must contain at least one uppercase letter.&amp;quot;,&lt;br /&gt;
      &amp;quot;The password must contain at least one number.&amp;quot;,&lt;br /&gt;
      &amp;quot;The password must contain at least one special character.&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ConflictError ===&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;ConflictError&amp;lt;/code&amp;gt; occurs when your request would cause a conflict, for instance if you attempt to register using an email address that&amp;#039;s already in use. It includes an additional attribute, &amp;lt;code&amp;gt;conflict&amp;lt;/code&amp;gt;, that includes an identifier of the existing object that would be in conflict. This is generally useful for debugging.&lt;br /&gt;
&lt;br /&gt;
=== UnknownClientError ===&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s rare that you&amp;#039;ll see an &amp;lt;code&amp;gt;UnknownClientError&amp;lt;/code&amp;gt;. It generally means something was wrong with your request to the API. It includes an additional attribute in the data object: &amp;lt;code&amp;gt;detail&amp;lt;/code&amp;gt;. This may provide additional detail as to why the error occurred.&lt;/div&gt;</summary>
		<author><name>Sarah</name></author>
	</entry>
</feed>