Permalink
Browse files

Removed UserError. Treat invalid package.json as non-existent package…

….json.
  • Loading branch information...
1 parent 8c7032e commit ffb5793fa333dd5904dc530bdb1bf2c3fc78e7d9 @scottgonzalez scottgonzalez committed Jan 4, 2012
Showing with 4 additions and 21 deletions.
  1. +1 −2 src/hook.js
  2. +3 −7 src/service.js
  3. +0 −12 src/user-error.js
View
3 src/hook.js
@@ -1,6 +1,5 @@
var semver = require( "semver" ),
Step = require( "step" ),
- UserError = require( "./user-error" ),
pluginsDb = require( "./pluginsdb" ),
service = require( "./service" ),
retry = require( "./retrydb" ),
@@ -134,7 +133,7 @@ function processRelease( repo, release, fn ) {
if ( owner !== repo.userName ) {
// TODO: report error to user
logger.log( repo.userName + " attempted to add " + release.package.name + " which is owned by " + owner );
- return fn( new UserError( "Plugin " + release.package.name + " is owned by " + owner + "." ) );
+ return fn( null, null );
}
return owner;
View
10 src/service.js
@@ -1,6 +1,5 @@
var semver = require( "semver" ),
Step = require( "step" ),
- UserError = require( "./user-error" ),
config = require( "./config" );
function extend( a, b ) {
@@ -36,7 +35,8 @@ extend( Repo.prototype, {
try {
var package = JSON.parse( package );
} catch( error ) {
- return fn( new UserError( "Could not parse package.json for " + version + "." ) );
+ // TODO: report error to user?
+ return fn( null, null );
}
fn( null, package );
@@ -150,11 +150,7 @@ extend( Repo.prototype, {
// check if we found a package.json
function( error, package ) {
if ( error ) {
- if ( error.userError ) {
- // TODO: report error to user
- } else {
- // TODO: log error for retry
- }
+ // TODO: log error for retry
return fn( error );
}
View
12 src/user-error.js
@@ -1,12 +0,0 @@
-var util = require( "util" );
-
-function UserError( msg ) {
- Error.call( this );
- this.message = msg;
- this.userError = true;
- Error.captureStackTrace( this, this.constructor );
-};
-
-util.inherits( UserError, Error );
-
-module.exports = UserError;

0 comments on commit ffb5793

Please sign in to comment.