Skip to content

Commit

Permalink
updating the azle book
Browse files Browse the repository at this point in the history
  • Loading branch information
lastmjs committed Jan 16, 2025
1 parent bfda745 commit a12a5d0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions docs/debugging.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ <h2 id="no-error-message"><a class="header" href="#no-error-message">No error me
&lt;title&gt;Error&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;pre&gt; &amp;nbsp; &amp;nbsp;at &amp;lt;anonymous&amp;gt; (azle_main:110643)&lt;br&gt; &amp;nbsp; &amp;nbsp;at handle (azle_main:73283)&lt;br&gt; &amp;nbsp; &amp;nbsp;at next (azle_main:73452)&lt;br&gt; &amp;nbsp; &amp;nbsp;at dispatch (azle_main:73432)&lt;br&gt; &amp;nbsp; &amp;nbsp;at handle (azle_main:73283)&lt;br&gt; &amp;nbsp; &amp;nbsp;at &amp;lt;anonymous&amp;gt; (azle_main:73655)&lt;br&gt; &amp;nbsp; &amp;nbsp;at process_params (azle_main:73692)&lt;br&gt; &amp;nbsp; &amp;nbsp;at next (azle_main:73660)&lt;br&gt; &amp;nbsp; &amp;nbsp;at expressInit (azle_main:73910)&lt;br&gt; &amp;nbsp; &amp;nbsp;at handle (azle_main:73283)&lt;br&gt; &amp;nbsp; &amp;nbsp;at trim_prefix (azle_main:73684)&lt;br&gt; &amp;nbsp; &amp;nbsp;at &amp;lt;anonymous&amp;gt; (azle_main:73657)&lt;br&gt; &amp;nbsp; &amp;nbsp;at process_params (azle_main:73692)&lt;br&gt; &amp;nbsp; &amp;nbsp;at next (azle_main:73660)&lt;br&gt; &amp;nbsp; &amp;nbsp;at query3 (azle_main:73938)&lt;br&gt; &amp;nbsp; &amp;nbsp;at handle (azle_main:73283)&lt;br&gt; &amp;nbsp; &amp;nbsp;at trim_prefix (azle_main:73684)&lt;br&gt; &amp;nbsp; &amp;nbsp;at &amp;lt;anonymous&amp;gt; (azle_main:73657)&lt;br&gt; &amp;nbsp; &amp;nbsp;at process_params (azle_main:73692)&lt;br&gt; &amp;nbsp; &amp;nbsp;at next (azle_main:73660)&lt;br&gt; &amp;nbsp; &amp;nbsp;at handle (azle_main:73587)&lt;br&gt; &amp;nbsp; &amp;nbsp;at handle (azle_main:76233)&lt;br&gt; &amp;nbsp; &amp;nbsp;at app2 (azle_main:78091)&lt;br&gt; &amp;nbsp; &amp;nbsp;at call (native)&lt;br&gt; &amp;nbsp; &amp;nbsp;at emitTwo (azle_main:9782)&lt;br&gt; &amp;nbsp; &amp;nbsp;at emit2 (azle_main:10023)&lt;br&gt; &amp;nbsp; &amp;nbsp;at httpHandler (azle_main:87618)&lt;br&gt;&lt;/pre&gt;
&lt;pre&gt; &amp;nbsp; &amp;nbsp;at &amp;lt;anonymous&amp;gt; (.azle/main.js:110643)&lt;br&gt; &amp;nbsp; &amp;nbsp;at handle (.azle/main.js:73283)&lt;br&gt; &amp;nbsp; &amp;nbsp;at next (.azle/main.js:73452)&lt;br&gt; &amp;nbsp; &amp;nbsp;at dispatch (.azle/main.js:73432)&lt;br&gt; &amp;nbsp; &amp;nbsp;at handle (.azle/main.js:73283)&lt;br&gt; &amp;nbsp; &amp;nbsp;at &amp;lt;anonymous&amp;gt; (.azle/main.js:73655)&lt;br&gt; &amp;nbsp; &amp;nbsp;at process_params (.azle/main.js:73692)&lt;br&gt; &amp;nbsp; &amp;nbsp;at next (.azle/main.js:73660)&lt;br&gt; &amp;nbsp; &amp;nbsp;at expressInit (.azle/main.js:73910)&lt;br&gt; &amp;nbsp; &amp;nbsp;at handle (.azle/main.js:73283)&lt;br&gt; &amp;nbsp; &amp;nbsp;at trim_prefix (.azle/main.js:73684)&lt;br&gt; &amp;nbsp; &amp;nbsp;at &amp;lt;anonymous&amp;gt; (.azle/main.js:73657)&lt;br&gt; &amp;nbsp; &amp;nbsp;at process_params (.azle/main.js:73692)&lt;br&gt; &amp;nbsp; &amp;nbsp;at next (.azle/main.js:73660)&lt;br&gt; &amp;nbsp; &amp;nbsp;at query3 (.azle/main.js:73938)&lt;br&gt; &amp;nbsp; &amp;nbsp;at handle (.azle/main.js:73283)&lt;br&gt; &amp;nbsp; &amp;nbsp;at trim_prefix (.azle/main.js:73684)&lt;br&gt; &amp;nbsp; &amp;nbsp;at &amp;lt;anonymous&amp;gt; (.azle/main.js:73657)&lt;br&gt; &amp;nbsp; &amp;nbsp;at process_params (.azle/main.js:73692)&lt;br&gt; &amp;nbsp; &amp;nbsp;at next (.azle/main.js:73660)&lt;br&gt; &amp;nbsp; &amp;nbsp;at handle (.azle/main.js:73587)&lt;br&gt; &amp;nbsp; &amp;nbsp;at handle (.azle/main.js:76233)&lt;br&gt; &amp;nbsp; &amp;nbsp;at app2 (.azle/main.js:78091)&lt;br&gt; &amp;nbsp; &amp;nbsp;at call (native)&lt;br&gt; &amp;nbsp; &amp;nbsp;at emitTwo (.azle/main.js:9782)&lt;br&gt; &amp;nbsp; &amp;nbsp;at emit2 (.azle/main.js:10023)&lt;br&gt; &amp;nbsp; &amp;nbsp;at httpHandler (.azle/main.js:87618)&lt;br&gt;&lt;/pre&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p>or like this:</p>
<pre><code>2024-04-17 14:35:30.433501980 UTC: [Canister bkyz2-fmaaa-aaaaa-qaaaq-cai] &quot; at &lt;anonymous&gt; (azle_main:110643)\n at handle (azle_main:73283)\n at next (azle_main:73452)\n at dispatch (azle_main:73432)\n at handle (azle_main:73283)\n at &lt;anonymous&gt; (azle_main:73655)\n at process_params (azle_main:73692)\n at next (azle_main:73660)\n at expressInit (azle_main:73910)\n at handle (azle_main:73283)\n at trim_prefix (azle_main:73684)\n at &lt;anonymous&gt; (azle_main:73657)\n at process_params (azle_main:73692)\n at next (azle_main:73660)\n at query3 (azle_main:73938)\n at handle (azle_main:73283)\n at trim_prefix (azle_main:73684)\n at &lt;anonymous&gt; (azle_main:73657)\n at process_params (azle_main:73692)\n at next (azle_main:73660)\n at handle (azle_main:73587)\n at handle (azle_main:76233)\n at app2 (azle_main:78091)\n at call (native)\n at emitTwo (azle_main:9782)\n at emit2 (azle_main:10023)\n at httpHandler (azle_main:87618)\n&quot;
<pre><code>2024-04-17 14:35:30.433501980 UTC: [Canister bkyz2-fmaaa-aaaaa-qaaaq-cai] &quot; at &lt;anonymous&gt; (.azle/main.js:110643)\n at handle (.azle/main.js:73283)\n at next (.azle/main.js:73452)\n at dispatch (.azle/main.js:73432)\n at handle (.azle/main.js:73283)\n at &lt;anonymous&gt; (.azle/main.js:73655)\n at process_params (.azle/main.js:73692)\n at next (.azle/main.js:73660)\n at expressInit (.azle/main.js:73910)\n at handle (.azle/main.js:73283)\n at trim_prefix (.azle/main.js:73684)\n at &lt;anonymous&gt; (.azle/main.js:73657)\n at process_params (.azle/main.js:73692)\n at next (.azle/main.js:73660)\n at query3 (.azle/main.js:73938)\n at handle (.azle/main.js:73283)\n at trim_prefix (.azle/main.js:73684)\n at &lt;anonymous&gt; (.azle/main.js:73657)\n at process_params (.azle/main.js:73692)\n at next (.azle/main.js:73660)\n at handle (.azle/main.js:73587)\n at handle (.azle/main.js:76233)\n at app2 (.azle/main.js:78091)\n at call (native)\n at emitTwo (.azle/main.js:9782)\n at emit2 (.azle/main.js:10023)\n at httpHandler (.azle/main.js:87618)\n&quot;
2024-04-17T14:35:31.983590Z ERROR tower_http::trace::on_failure: response failed classification=Status code: 500 Internal Server Error latency=101 ms
2024-04-17 14:36:34.652587412 UTC: [Canister bkyz2-fmaaa-aaaaa-qaaaq-cai] &quot; at &lt;anonymous&gt; (azle_main:110643)\n at handle (azle_main:73283)\n at next (azle_main:73452)\n at dispatch (azle_main:73432)\n at handle (azle_main:73283)\n at &lt;anonymous&gt; (azle_main:73655)\n at process_params (azle_main:73692)\n at next (azle_main:73660)\n at expressInit (azle_main:73910)\n at handle (azle_main:73283)\n at trim_prefix (azle_main:73684)\n at &lt;anonymous&gt; (azle_main:73657)\n at process_params (azle_main:73692)\n at next (azle_main:73660)\n at query3 (azle_main:73938)\n at handle (azle_main:73283)\n at trim_prefix (azle_main:73684)\n at &lt;anonymous&gt; (azle_main:73657)\n at process_params (azle_main:73692)\n at next (azle_main:73660)\n at handle (azle_main:73587)\n at handle (azle_main:76233)\n at app2 (azle_main:78091)\n at call (native)\n at emitTwo (azle_main:9782)\n at emit2 (azle_main:10023)\n at httpHandler (azle_main:87618)\n&quot;
2024-04-17 14:36:34.652587412 UTC: [Canister bkyz2-fmaaa-aaaaa-qaaaq-cai] &quot; at &lt;anonymous&gt; (.azle/main.js:110643)\n at handle (.azle/main.js:73283)\n at next (.azle/main.js:73452)\n at dispatch (.azle/main.js:73432)\n at handle (.azle/main.js:73283)\n at &lt;anonymous&gt; (.azle/main.js:73655)\n at process_params (.azle/main.js:73692)\n at next (.azle/main.js:73660)\n at expressInit (.azle/main.js:73910)\n at handle (.azle/main.js:73283)\n at trim_prefix (.azle/main.js:73684)\n at &lt;anonymous&gt; (.azle/main.js:73657)\n at process_params (.azle/main.js:73692)\n at next (.azle/main.js:73660)\n at query3 (.azle/main.js:73938)\n at handle (.azle/main.js:73283)\n at trim_prefix (.azle/main.js:73684)\n at &lt;anonymous&gt; (.azle/main.js:73657)\n at process_params (.azle/main.js:73692)\n at next (.azle/main.js:73660)\n at handle (.azle/main.js:73587)\n at handle (.azle/main.js:76233)\n at app2 (.azle/main.js:78091)\n at call (native)\n at emitTwo (.azle/main.js:9782)\n at emit2 (.azle/main.js:10023)\n at httpHandler (.azle/main.js:87618)\n&quot;
</code></pre>
<p>In these situations you might be able to use <code>try/catch</code> with a <code>console.log</code> of the catch error argument to reveal the underlying error message.</p>
<p>For example, this code without a <code>try/catch</code> will log errors without the message <code>This is the error text</code>:</p>
Expand Down Expand Up @@ -216,7 +216,7 @@ <h2 id="no-error-message"><a class="header" href="#no-error-message">No error me
</code></pre>
<h2 id="final-compiled-and-bundled-javascript"><a class="header" href="#final-compiled-and-bundled-javascript">Final Compiled and Bundled JavaScript</a></h2>
<p>Azle compiles and bundles your TypeScript/JavaScript into a final JavaScript file to be included and executed inside of your canister. Inspecting this final JavaScript code may help you to debug your application.</p>
<p>When you see something like <code>(azle_main:110643)</code> in your error stack traces, it is a reference to the final compiled and bundled JavaScript file that is actually deployed with and executed by the canister. The right-hand side of <code>azle_main</code> e.g. <code>:110643</code> is the line number in that file.</p>
<p>When you see something like <code>(.azle/main.js:110643)</code> in your error stack traces, it is a reference to the final compiled and bundled JavaScript file that is actually deployed with and executed by the canister. The right-hand side of <code>.azle/main.js</code> e.g. <code>:110643</code> is the line number in that file.</p>
<p>You can find the file at <code>[project_name]/.azle/[canister_name]/canister/src/main.js</code>. If you have the <code>AZLE_AUTORELOAD</code> environment variable set to <code>true</code> then you should instead look at <code>[project_name]/.azle/[canister_name]/canister/src/main_reloaded.js</code></p>

</main>
Expand Down
Loading

0 comments on commit a12a5d0

Please sign in to comment.