Jeremy Sandell avatar Jeremy Sandell committed 719da09 Draft

switched summary to a version

Comments (0)

Files changed (1)

net/http/parser.di

 }
 
 
-
 //debug=info;
 //debug=memory;
 //debug=loud;
-//debug=summary;
 
-
-debug (loud)
+version(summary)
 {
-    private import std.stdio;
+    
+    private import std.stdio : writefln, write;
 }
-
-debug(info)
+else
 {
-    private import std.stdio;
-}
-
-debug(memory)
-{
-    private import std.c.stdio;
-    private import std.stdio;
-}
-debug(summary)
-{
-    private import std.stdio;
+    // for debugging
+    version(inspect)
+    {
+        private import std.c.stdio : printf;
+        private import std.stdio : writefln;
+    }
 }
 
 
         int count;
     };
 
-    debug(summary)
+    version(summary)
     {
         struct _callback_info {
             /* notification switches so we can see whether a call back has fired at least once. */
 
     struct message_data {
         _headers *headers;
-        debug(summary) _callback_info callback_info;
+        version(summary) _callback_info callback_info;
 
         char *content;
         ulong content_length;
 
         debug(memory) writefln("[inject_shim] initialize callback data.");
 
-        debug(summary)
+        version(summary)
         {
             m.callback_info.on_message_begin = 0;
             m.callback_info.on_url = 0;
             writefln("[parse] errno = OK: %s", parser.http_errno == http_errno.HPE_OK);
         }
 
-        debug(summary)
+        version(summary)
         {
             foreach(int x; 0..40)
                 write("-");
         }
         else
         {
-            /* Something went wrong while parsing...*/
+            /* Something went wrong while parsing... will need to come back to
+             * this, however for now at least this is better than silently
+             * swallowing the error.
+             */
 
+            string msg = to!string(http_errno_name(cast(http_errno)parser.http_errno));
+            throw new Exception(msg);
         }
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.