diff options
Diffstat (limited to 'node_modules/montage/core/exception.js')
-rwxr-xr-x | node_modules/montage/core/exception.js | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/node_modules/montage/core/exception.js b/node_modules/montage/core/exception.js new file mode 100755 index 00000000..4cca326d --- /dev/null +++ b/node_modules/montage/core/exception.js | |||
@@ -0,0 +1,95 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | var Montage = require("montage").Montage; | ||
7 | var logger = require("core/logger").logger("exception"); | ||
8 | /** | ||
9 | @module montage/core/exception | ||
10 | @requires montage/core/core | ||
11 | @requires montage/core/logger | ||
12 | */ | ||
13 | /** | ||
14 | @class module:montage/core/exception.Exception | ||
15 | @extends module:montage/core/core.Montage | ||
16 | */ | ||
17 | var Exception = exports.Exception = Montage.create(Montage,/** @lends module:montage/core/exception.Exception# */ { | ||
18 | /** | ||
19 | @type {Property} | ||
20 | @default {String} null | ||
21 | */ | ||
22 | message: { | ||
23 | value: null, | ||
24 | serializable: true | ||
25 | }, | ||
26 | /** | ||
27 | @type {Property} | ||
28 | @default {String} null | ||
29 | */ | ||
30 | target: { | ||
31 | value: null, | ||
32 | serializable: true | ||
33 | }, | ||
34 | /** | ||
35 | @type {Property} | ||
36 | @default {Function} null | ||
37 | */ | ||
38 | method: { | ||
39 | value: null, | ||
40 | serializable: true | ||
41 | }, | ||
42 | /** | ||
43 | @function | ||
44 | @param {String} message The message to be initialized. | ||
45 | @returns this.initWithMessageTargetAndMethod(message, null, null) | ||
46 | */ | ||
47 | initWithMessage : { | ||
48 | enumerable: true, | ||
49 | value: function(message) { | ||
50 | return this.initWithMessageTargetAndMethod(message, null, null); | ||
51 | } | ||
52 | }, | ||
53 | /** | ||
54 | @function | ||
55 | @param {String} message The message to be initialized. | ||
56 | @param {String} target The target to be initialized. | ||
57 | @returns this.initWithMessageTargetAndMethod(message, target, null) | ||
58 | */ | ||
59 | initWithMessageAndTarget : { | ||
60 | enumerable: true, | ||
61 | value: function(message, target) { | ||
62 | return this.initWithMessageTargetAndMethod(message, target, null); | ||
63 | } | ||
64 | }, | ||
65 | /** | ||
66 | @function | ||
67 | @param {String} message The message to be initialized. | ||
68 | @param {String} target The target to be initialized. | ||
69 | @param {Function} method The method to be initialized. | ||
70 | @returns itself | ||
71 | */ | ||
72 | initWithMessageTargetAndMethod : { | ||
73 | enumerable: true, | ||
74 | value: function(message, target, method) { | ||
75 | this.message = (typeof message !== 'undefined' ? message : null); | ||
76 | Object.defineProperty(this, "message", {writable: false}); | ||
77 | this.target = (typeof target !== 'undefined' ? target : null); | ||
78 | Object.defineProperty(this, "target", {writable: false}); | ||
79 | this.method = (typeof method !== 'undefined' ? method : null); | ||
80 | Object.defineProperty(this, "method", {writable: false}); | ||
81 | return this; | ||
82 | } | ||
83 | }, | ||
84 | /** | ||
85 | @function | ||
86 | @returns The exception | ||
87 | */ | ||
88 | toString: { | ||
89 | enumerable: false, | ||
90 | value: function() { | ||
91 | return "Exception: " + (message !== null ? message + " " : null) + (target !== null ? target + " " : null) + (method !== null ? method + " " : null); | ||
92 | } | ||
93 | } | ||
94 | |||
95 | }); | ||