You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Johnny Weng Luu (JIRA)" <ji...@apache.org> on 2011/07/15 18:11:00 UTC
[jira] [Created] (COUCHDB-1223) require() an empty file will throw
error
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.
Must be a bug.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1223) require() an empty file will
throw error
Posted by "Johnny Weng Luu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13066068#comment-13066068 ]
Johnny Weng Luu commented on COUCHDB-1223:
------------------------------------------
I have some modules inside _design/app/lib .. one of them is empty eg the views:
{
views: "",
filters: { exports.... }
when I do: require(./views) I get that error.
If it contains anything like comments I won't get that error.
> 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
[jira] [Reopened] (COUCHDB-1223) require() an empty file will throw
error
Posted by "Paul Joseph Davis (Reopened) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Joseph Davis reopened COUCHDB-1223:
----------------------------------------
Apparently I can't edit the resolution.
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (COUCHDB-1223) require() an empty file will throw
error
Posted by "Paul Joseph Davis (Resolved) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Joseph Davis resolved COUCHDB-1223.
----------------------------------------
Resolution: Fixed
Fix Version/s: 1.2
1.1.1
Fixed in trunk as of r1176677. Backported to 1.2.x in r1176678 and 1.1.x in r1176679.
> 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
> Fix For: 1.1.1, 1.2
>
>
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (COUCHDB-1223) require() an empty file will throw
error
Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Newson resolved COUCHDB-1223.
------------------------------------
Resolution: Incomplete
Incomplete description of problem. Please reopen with more details.
> 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.
> Must be a bug.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1223) require() an empty file will
throw error
Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
[ 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
[jira] [Reopened] (COUCHDB-1223) require() an empty file will throw
error
Posted by "Johnny Weng Luu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Johnny Weng Luu reopened COUCHDB-1223:
--------------------------------------
Added the error message I get when the file is empty.
> 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
[jira] [Commented] (COUCHDB-1223) require() an empty file will
throw error
Posted by "Johnny Weng Luu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13066076#comment-13066076 ]
Johnny Weng Luu commented on COUCHDB-1223:
------------------------------------------
But if I have comments in it it makes it useless too.
Also if I have code in it but no "exports" objects it is not a module either.
So the argument isn't solid.
> 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
[jira] [Updated] (COUCHDB-1223) require() an empty file will throw
error
Posted by "Johnny Weng Luu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Johnny Weng Luu updated COUCHDB-1223:
-------------------------------------
Description:
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.
was:
When the file I require() is empty CouchDB throws an error.
Must be a bug.
> 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
[jira] [Resolved] (COUCHDB-1223) require() an empty file will throw
error
Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Newson resolved COUCHDB-1223.
------------------------------------
Resolution: Won't Fix
SpiderMonkey (our JavaScript engine) throws an error if you try to compile an empty string. Given that an empty module is useless, I think this is reasonable behavior.
> 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