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

});