Sha256: 3c01222a0d971be0ca124bbfc5b8e0e8696b390ed08b14cbc6177de9b4add110

Contents?: true

Size: 1.19 KB

Versions: 9

Compression:

Stored size: 1.19 KB

Contents

// ========================================================================
// SproutCore
// copyright 2006-2008 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

9 entries across 9 versions & 1 rubygems

Version Path
sproutcore-0.9.10 frameworks/sproutcore/foundation/error.js
sproutcore-0.9.2 frameworks/sproutcore/foundation/error.js
sproutcore-0.9.4 frameworks/sproutcore/foundation/error.js
sproutcore-0.9.3 frameworks/sproutcore/foundation/error.js
sproutcore-0.9.5 frameworks/sproutcore/foundation/error.js
sproutcore-0.9.8 frameworks/sproutcore/foundation/error.js
sproutcore-0.9.7 frameworks/sproutcore/foundation/error.js
sproutcore-0.9.6 frameworks/sproutcore/foundation/error.js
sproutcore-0.9.9 frameworks/sproutcore/foundation/error.js