couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Newson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COUCHDB-1223) require() an empty file will throw error
Date Fri, 15 Jul 2011 16:37:00 GMT

    [ https://issues.apache.org/jira/browse/COUCHDB-1223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13066062#comment-13066062
] 

Robert Newson commented on COUCHDB-1223:
----------------------------------------

Do you mean 'design document' when you say 'file'? Are you including all of the modules that
you require in your design document? Please see http://wiki.apache.org/couchdb/CommonJS_Modules.

T clarify, you cannot require anything outside of your design document, is that the bug you
are reporting?

> require() an empty file will throw error
> ----------------------------------------
>
>                 Key: COUCHDB-1223
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1223
>             Project: CouchDB
>          Issue Type: Bug
>            Reporter: Johnny Weng Luu
>
> When the file I require() is empty CouchDB throws an error.
> {"error":"compilation_error","reason":"Module require('kanso/core') raised error [\"error\",
\"compilation_error\", \"Module require('lib/app') raised error [\\\"error\\\", \\\"invalid_require_path\\\",
\\\"Object has no property \\\\\\\"views\\\\\\\". {\\\\\\\"views\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"app\\\\\\\":\\\\\\\"/**\\\\\\\\u000a
* Values exported from this module will automatically be used to generate\\\\\\\\u000a * the
design doc pushed to CouchDB.\\\\\\\\u000a */\\\\\\\\u000a\\\\\\\\u000amodule.exports = {\\\\\\\\u000a
   types: require('./types'),\\\\\\\\u000a    shows: require('./shows'),\\\\\\\\u000a    lists:
require('./lists'),\\\\\\\\u000a    views: require('./views'),\\\\\\\\u000a    updates: require('./updates'),\\\\\\\\u000a
   filters: require('./filters'),\\\\\\\\u000a    rewrites: require('./rewrites'),\\\\\\\\u000a
   validate_doc_update: require('./validate'),\\\\\\\\u000a    events: require('./events')\\\\\\\\u000a};\\\\\\\\u000a\\\\\\\",\\\\\\\"events\\\\\\\":\\\\\\\"/**\\\\\\\\u000a
* Bindings to Kanso events\\\\\\\\u000a */\\\\\\\\u000a\\\\\\\\u000avar events = require('kanso/events');\\\\\\\\u000a\\\\\\\\u000a\\\\\\\\u000a/**\\\\\\\\u000a
* The init method fires when the app is initially loaded from a page rendered\\\\\\\\u000a
* by CouchDB.\\\\\\\\u000a */\\\\\\\\u000a\\\\\\\\u000a/**\\\\\\\\u000a * events.on('init',
function () {\\\\\\\\u000a *     // app initialization code goes here...\\\\\\\\u000a * });\\\\\\\\u000a
*/\\\\\\\\u000a\\\\\\\\u000a\\\\\\\\u000a/**\\\\\\\\u000a * The sessionChange event fires
when the app is first loaded and the user's\\\\\\\\u000a * session information becomes available.
It is also fired whenever a change\\\\\\\\u000a * to the user's session is detected, for example
after logging in or out.\\\\\\\\u000a */\\\\\\\\u000a\\\\\\\\u000a/**\\\\\\\\u000a * events.on('sessionChange',
function (userCtx, req) {\\\\\\\\u000a *     // session change handling code goes here...\\\\\\\\u000a
* });\\\\\\\\u000a */\\\\\\\\u000a\\\\\\\\u000a\\\\\\\\u000a/**\\\\\\\\u000a * The updateFailure
event fires when an update function returns a document as\\\\\\\\u000a * the first part of
an array, but the client-side request to update the\\\\\\\\u000a * document fails.\\\\\\\\u000a
*/\\\\\\\\u000a\\\\\\\\u000aevents.on('updateFailure', function (err, info, req, res, doc)
{\\\\\\\\u000a    alert(err.message || err.toString());\\\\\\\\u000a});\\\\\\\\u000a\\\\\\\",\\\\\\\"filters\\\\\\\":\\\\\\\"/**\\\\\\\\u000a
* \\\\\\\\u000a */\\\\\\\",\\\\\\\"lists\\\\\\\":\\\\\\\"/**\\\\\\\\u000a * Lists\\\\\\\\u000a
*/\\\\\\\",\\\\\\\"rewrites\\\\\\\":\\\\\\\"//------------------------------------------------------------------------------\\\\\\\\u000a//
Init\\\\\\\\u000a//------------------------------------------------------------------------------\\\\\\\\u000a//------------------------------------------------------------------------------\\\\\\\\u000a//
Rewrites\\\\\\\\u000a//------------------------------------------------------------------------------\\\\\\\\u000amodule.exports
= [{\\\\\\\\u000a  \\\\\\\\\\\\\\\"method\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"GET\\\\\\\\\\\\\\\",\\\\\\\\u000a
 \\\\\\\\\\\\\\\"from\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"/tests\\\\\\\\\\\\\\\",\\\\\\\\u000a
 \\\\\\\\\\\\\\\"to\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"_show/tests\\\\\\\\\\\\\\\"\\\\\\\\u000a},
{\\\\\\\\u000a  \\\\\\\\\\\\\\\"method\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"*\\\\\\\\\\\\\\\",\\\\\\\\u000a
 \\\\\\\\\\\\\\\"from\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"*\\\\\\\\\\\\\\\",\\\\\\\\u000a  \\\\\\\\\\\\\\\"to\\\\\\\\\\\\\\\":
\\\\\\\\\\\\\\\"../../../*\\\\\\\\\\\\\\\"\\\\\\\\u000a}];\\\\\\\",\\\\\\\"shows\\\\\\\":\\\\\\\"//------------------------------------------------------------------------------\\\\\\\\u000a//
Init\\\\\\\\u000a//------------------------------------------------------------------------------\\\\\\\\u000avar
templates = require('kanso/templates');\\\\\\\\u000a\\\\\\\\u000a//------------------------------------------------------------------------------\\\\\\\\u000a//
Shows\\\\\\\\u000a//------------------------------------------------------------------------------\\\\\\\\u000aexports.tests
= function(doc, req) {\\\\\\\\u000a\\\\\\\\u000a  var scripts = templates.render('tests.html',
req, {});\\\\\\\\u000a  \\\\\\\\u000a  var body = templates.render('base.html', req, {\\\\\\\\u000a
   \\\\\\\\\\\\\\\"title\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"Jasmine Spec Runner\\\\\\\\\\\\\\\",\\\\\\\\u000a
   \\\\\\\\\\\\\\\"scripts\\\\\\\\\\\\\\\": scripts,\\\\\\\\u000a    \\\\\\\\\\\\\\\"content\\\\\\\\\\\\\\\":
\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\u000a  });\\\\\\\\u000a\\\\\\\\u000a  return {\\\\\\\\u000a
   \\\\\\\\\\\\\\\"headers\\\\\\\\\\\\\\\": {\\\\\\\\u000a      \\\\\\\\\\\\\\\"Content-Type\\\\\\\\\\\\\\\":
\\\\\\\\\\\\\\\"text/html\\\\\\\\\\\\\\\"\\\\\\\\u000a    },\\\\\\\\u000a    \\\\\\\\\\\\\\\"body\\\\\\\\\\\\\\\":
body\\\\\\\\u000a  };\\\\\\\\u000a\\\\\\\\u000a};\\\\\\\\u000a\\\\\\\\u000aexports.not_found
= function(doc, req) {\\\\\\\\u000a  return {\\\\\\\\u000a    \\\\\\\\\\\\\\\"title\\\\\\\\\\\\\\\":
\\\\\\\\\\\\\\\"404 - Not Found\\\\\\\\\\\\\\\",\\\\\\\\u000a    \\\\\\\\\\\\\\\"content\\\\\\\\\\\\\\\":
templates.render('404.html', req, {})\\\\\\\\u000a  };\\\\\\\\u000a};\\\\\\\",\\\\\\\"types\\\\\\\":\\\\\\\"/**\\\\\\\\u000a
* \\\\\\\\u000a */\\\\\\\",\\\\\\\"updates\\\\\\\":\\\\\\\"/**\\\\\\\\u000a * \\\\\\\\u000a
*/\\\\\\\",\\\\\\\"validate\\\\\\\":\\\\\\\"//------------------------------------------------------------------------------\\\\\\\\u000a//
Init\\\\\\\\u000a//------------------------------------------------------------------------------\\\\\\\\u000avar
types = require('kanso/types'),\\\\\\\\u000a    app_types = require('./types');\\\\\\\\u000a\\\\\\\\u000a//------------------------------------------------------------------------------\\\\\\\\u000a//
Validate\\\\\\\\u000a//------------------------------------------------------------------------------\\\\\\\\u000a/**\\\\\\\\u000aValidates
document to be created/updated.\\\\\\\\u000a\\\\\\\\u000aValidation\\\\\\\\u000a----------\\\\\\\\u000a-
One per design document\\\\\\\\u000a- If multiple validation functions exist for a database,
all of them will be run. If one throws error the create/update is blocked.\\\\\\\\u000a\\\\\\\\u000aFunctions
used inside the validate function\\\\\\\\u000a-------------------------------------------\\\\\\\\u000a-
throw({unauthorized: message}) // Throws an unauthorized error and blocks the update.\\\\\\\\u000a-
throw({forbidden: message}) // Throws a forbidden error and blocks the update.\\\\\\\\u000a\\\\\\\\u000a\\\\\\\\u000a@param
{Object} newDoc Document from the client.\\\\\\\\u000a@param {Object} oldDoc Existing document
in the database.\\\\\\\\u000a@param {Object} userCtx User information.\\\\\\\\u000a**/\\\\\\\\u000amodule.exports
= function(newDoc, oldDoc, userCtx) {\\\\\\\\u000a  types.validate_doc_update(app_types, newDoc,
oldDoc, userCtx);\\\\\\\\u000a};\\\\\\\"}\\\"]\"]"}
> When I add a comment in it the error disappears.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message