1# Copyright (c) 2006-2008, The RubyCocoa Project.
2# Copyright (c) 2001-2006, FUJIMOTO Hisakuni.
3# All Rights Reserved.
4#
5# RubyCocoa is free software, covered under either the Ruby's license or the 
6# LGPL. See the COPYRIGHT file for more information.
7
8module OSX
9
10  def self._debug?
11    ($DEBUG || $RUBYCOCOA_DEBUG)
12  end
13
14  class OCException < RuntimeError
15
16    attr_reader :name, :reason, :userInfo, :nsexception
17
18    def initialize(ocexcp, msg = nil)
19      @nsexception = ocexcp
20      @name = @nsexception.objc_send(:name).to_s
21      @reason = @nsexception.objc_send(:reason).to_s
22      @userInfo = @nsexception.objc_send(:userInfo)
23      msg = "#{@name} - #{@reason}" if msg.nil?
24      super(msg)
25    end
26
27  end
28
29  class OCDataConvException < RuntimeError
30  end
31
32  class OCMessageSendException < RuntimeError
33  end
34
35end
36