Sha256: 42a252e8e9e817d7c9b08cf43c4f0b78362613da2dc326ec0ff50e73c586302f

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

// ========================================================================
// SproutCore
// copyright 2006-2007 Sprout Systems, Inc.
// ========================================================================

require('foundation/object');

// Error is used to communicate errors throughout the app.
SC.Error = SC.Object.extend({
  code: -1, // error code. Used to designate type.
  description: '', // human readable dscriptions.
  label: null // optionally set to human readable the name of the item with the error.
}) ;

// this will create a new instance of the receiver with the passed 
// description, etc.
SC.Error.desc = function(description, label, code) {
  var opts = { description: description } ;
  if (label !== undefined) opts.label = label ;
  if (code !== undefined) opts.code = code ;
  return this.create(opts) ;
} ;

// returns an error object.
function $error(description, label, c) { 
  return SC.Error.desc(description,label, c); 
} ;


// returns true if the return value is not false or an error.
function $ok(ret) {
  return (ret !== false) && ($type(ret) != T_ERROR) ;
}


// STANDARD ERROR OBJECTS

// Used by objects that do not support multiple values.
SC.Error.HAS_MULTIPLE_VALUES = -100 ;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sproutcore-0.9.0 frameworks/sproutcore/foundation/error.js
sproutcore-0.9.1 frameworks/sproutcore/foundation/error.js