www.gusucode.com > appdesigner工具箱matlab源码程序 > appdesigner/+appdesigner/+internal/+appalert/CallbackException.m

    classdef CallbackException < MException
    %CALLBACKEXCEPTION Captures App Designer app callback error information
    %
    % Copyright 2015 The MathWorks, Inc.    
    
    properties
       App
       Exception
    end
    
    methods
        function obj = CallbackException(mException, app)
            
            % Call MException constructor to setup the identifier and
            % message properties
            obj@MException(mException.identifier, mException.message);
            
            % Update the type to be the same as the input MException. This
            % needs to be done so that getReport() works properly.
            obj.type = mException.type;
            
            % Update the cause field to be the same as the input MException
            % This needs to be done so that getReport() works properly.
            for i=1:length(mException.cause)
                obj = addCause(obj,mException.cause{i});
            end
            
            obj.Exception = mException;
            
            obj.App = app;
        end
    end
   
    methods (Access = protected)
        function stack = getStack(obj)
            % STACK = GETSTACK(OBJ) This method overrides the inherited
            % GETSTACK method from MException. It returns the original
            % stack. It is necessary to override this method so that the
            % method GETREPORT generates the correct message.
            
            stack = obj.Exception.stack;
        end
    end
   
end