Change 1083

tony_smith (Tony Smith)
Tony Smith committed this change into //guest/tony_smith/perforce/API/Ruby/main
Request Review
Download .zip
Sweeping change to exception handling and garbage collection.

Exceptions are no longer raised for errors encoutered during
execution of Perforce commands as that was causing processing
to abort at the first error when several success messages may
have been close behind.

Now exceptions are raised for events which are fatal to the
execution of commands - such as failure to connect to the
Perforce server for example. For other errors, the user must
call "p4.errors? " to determine whether or not errors occured
and "p4.errors" to get an array of error messages. You can
of course then raise exceptions yourself if you want to:

begin
    client = p4.fetch_client
    if p4.errors?
    raise P4Exception, "p4 client -o failed"
    end
rescue P4Exception => m
    puts( m  )
    p4.errors.each { |e| puts( e ) }
end

version.h got renamed because it conflicts with ruby's own
version.h file. We may need to look in there at some point
for ruby's version so I'm getting it out of the way now.

       Added gc_hack.h to make sure that GC works properly on all
platforms now so Ruby shouldn't nuke any objects we're holding now.
  • Files 11
  • Comments 0
6 edited 2 added 3 deleted
clientuserruby.cc#4
Loading...
clientuserruby.h#4
Loading...
example.rb#3
Loading...
gc_hack.h#1
Loading...
p4.cc#5
Loading...
p4clientapi.cc#6
Loading...
p4clientapi.h#3
Loading...
p4exception.cc#2
Loading...
p4exception.h#2
Loading...
p4rb_version.h#1
Loading...
version.h#2
Loading...
Tip: Use n and p to cycle through the changes.