Skip to content

Commit

Permalink
Merge pull request eventmachine#637 from shaicoleman/exceptions_from_…
Browse files Browse the repository at this point in the history
…standarderror

Replace Exception class with StandardError
  • Loading branch information
sodabrew committed Feb 25, 2016
2 parents 3b6d9e3 + 8e803ad commit 1f673a2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions ext/fastfilereader/rubymain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static VALUE mapper_new (VALUE self, VALUE filename)
{
Mapper_t *m = new Mapper_t (StringValueCStr (filename));
if (!m)
rb_raise (rb_eException, "No Mapper Object");
rb_raise (rb_eStandardError, "No Mapper Object");
VALUE v = Data_Wrap_Struct (Mapper, 0, mapper_dt, (void*)m);
return v;
}
Expand All @@ -65,17 +65,17 @@ static VALUE mapper_get_chunk (VALUE self, VALUE start, VALUE length)
Mapper_t *m = NULL;
Data_Get_Struct (self, Mapper_t, m);
if (!m)
rb_raise (rb_eException, "No Mapper Object");
rb_raise (rb_eStandardError, "No Mapper Object");

// TODO, what if some moron sends us a negative start value?
unsigned _start = NUM2INT (start);
unsigned _length = NUM2INT (length);
if ((_start + _length) > m->GetFileSize())
rb_raise (rb_eException, "Mapper Range Error");
rb_raise (rb_eStandardError, "Mapper Range Error");

const char *chunk = m->GetChunk (_start);
if (!chunk)
rb_raise (rb_eException, "No Mapper Chunk");
rb_raise (rb_eStandardError, "No Mapper Chunk");
return rb_str_new (chunk, _length);
}

Expand All @@ -88,7 +88,7 @@ static VALUE mapper_close (VALUE self)
Mapper_t *m = NULL;
Data_Get_Struct (self, Mapper_t, m);
if (!m)
rb_raise (rb_eException, "No Mapper Object");
rb_raise (rb_eStandardError, "No Mapper Object");
m->Close();
return Qnil;
}
Expand All @@ -102,7 +102,7 @@ static VALUE mapper_size (VALUE self)
Mapper_t *m = NULL;
Data_Get_Struct (self, Mapper_t, m);
if (!m)
rb_raise (rb_eException, "No Mapper Object");
rb_raise (rb_eStandardError, "No Mapper Object");
return INT2NUM (m->GetFileSize());
}

Expand Down
2 changes: 1 addition & 1 deletion lib/em/pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def process work, resource
else
raise ArgumentError, "deferrable expected from work"
end
rescue Exception
rescue
failure resource
raise
end
Expand Down
2 changes: 1 addition & 1 deletion lib/em/protocols/line_and_text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def receive_data data
@lpb_buffer.extract(data).each do |line|
receive_line(line.chomp) if respond_to?(:receive_line)
end
rescue Exception
rescue
receive_error('overlength line') if respond_to?(:receive_error)
close_connection
return
Expand Down
4 changes: 2 additions & 2 deletions lib/em/threaded_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def dispatch
begin
result = yield @resource
completion.succeed result
rescue Exception => e
rescue => e
completion.fail e
end
end
Expand All @@ -87,4 +87,4 @@ def shutdown
end

end
end
end

0 comments on commit 1f673a2

Please sign in to comment.