7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/griffin/interceptors/server/rails_exception_interceptor.rb', line 7
def request_response(*)
begin
yield
rescue ActiveRecord::RecordNotFound => e
capture_exception_if_defined(e)
raise GRPC::NotFound.new(e.message)
rescue ActiveRecord::StaleObjectError => e
capture_exception_if_defined(e)
raise GRPC::Aborted.new(e.message)
rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotSaved => e
capture_exception_if_defined(e)
raise GRPC::FailedPrecondition.new(e.message)
end
end
|