  at #{req.client.remoteAddress}."
         handler req, (err, data, customHeaders) =>
             if err?
-                # On error, `data` is an error code. Very rudimentary error
-                # handling, as it is not intended for humans anyway.
-                console.warn "Responded with #{data}: #{err.message} for #{req.url}."
-                res.writeHead data, 'Content-Type': 'text/plain'
-                res.write "#{data} - #{err.message}"
+                console.warn "Responded with #{err.code}: #{err.message} for #{req.url}."
+                res.writeHead err.code, 'Content-Type': 'text/plain'
+                res.write "#{err.code} - #{err.message}"
             else
                 # Make a header object for response.
                 # `null` means use default value.

                                        callback err, null, respHeaders
                                )
                    else
                        callback new Error('File Not Found'), 404
            else
                callback new Error('File Not Found'), 404

    # Get internal IP and pass IP/port to callback. Needed for SSDP messages.
    listen = (callback) ->

        switch category
            when 'device'
                if action isnt 'description'
                    return callback new HttpError 404
                @_buildDescription (err, desc) ->
                    return callback new HttpError 500 if err
                    callback null, desc

            when 'service'
