Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

mobiruby-ios why catch the exception but not putout the error message? #39

@charlescui

Description

@charlescui

@masuidrive

mobiruby-ios why catch the exception but not putout the error message?

I define a method with error, the options is not defined.

def show_transition(&blk)
    # completion = Cocoa::Block.new(CFunc::Void, [CFunc::Int]) { |finished|
    #     # puts "in item_trasition blk and finished is : #{finished}"
    #     blk.call(finished) if blk
    # }
    puts "transition animation:#{options}"
    duration = C::Double(2.5)
    # raise @front_view[:superview]
    begin
        # puts "@front_view[:superview]:#{@front_view.ivar[:_superview]}"
    rescue => e
        puts "Exception:#{e}"
    end
    # if @front_view[:superview]
    #   options = Cocoa::Const::UIViewAnimationOptionTransitionFlipFromLeft
    #   Cocoa::UIView._transitionFromView @front_view, :toView, @back_view, :duration, duration, :options, options, :completion, completion
    # else
    #   options = Cocoa::Const::UIViewAnimationOptionTransitionFlipFromRight
    #   Cocoa::UIView._transitionFromView @back_view, :toView, @front_view, :duration, duration, :options, options, :completion, completion
    # end

end

I use the method show_transition in cocoa function call, but the console with rake doesn't output any tips or backtrace or messages.It cause hard to find out the bug!

define C::Void, :touchesBegan, Cocoa::Object, :withEvent, Cocoa::Object do |touches, event|
    puts "Touch began!!!"
    begin
        show_transition{|f|
            puts "Finished:#{f}"
        }
    rescue Exception => e
        puts "Exception in touchBegan:#{e}"
    end
end

So, I try to catche the mruby exception manual,and puts the exception to help debug.

define C::Void, :touchesBegan, Cocoa::Object, :withEvent, Cocoa::Object do |touches, event|
    puts "Touch began!!!"
    show_transition{|f|
        puts "Finished:#{f}"
    }
end

Now, I found the error with the message:

Touch began!!!
Exception in touchBegan:Unknown method options

How to debug the mruby code in mobiruby-ios?
Why not raise the error out?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions