bug_bunny 4.10.1 → 4.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e1a5c8c069bdf7634c57b1df16aa226d5abc8fd6e864596d273431a680a1b55
4
- data.tar.gz: 49b7cf39e53fe8c3f3b90331cfc4f171c8769264356ba1c1d4a767bf27b868ee
3
+ metadata.gz: '08e0d33ac09d046d3de52d3d7f75b7b87df8d6e96f495ab37c7433fe9f4add33'
4
+ data.tar.gz: '09373953a7dc292c97363e3514f9e3db1b9b041527a9e26e09e52089abfda0b9'
5
5
  SHA512:
6
- metadata.gz: '082acc0c03183a7d077381563ab9da50657e7468006334b5cfc2d00c8442d603285d38d0f557d67793c833fd6c4d5133c82b3cbbe5048f7f89721c19082971b9'
7
- data.tar.gz: 9ee3d5a73a1e339d13241093bedfc9dfe212e2a77fb655f3fe21f1378b02d5e10c86417e12fe637eaa1f9591be3ae1e7c2a72d6ed3dac5ee3007f05d1ee7159f
6
+ metadata.gz: 34799b71420bb76ca71439e80d5b27a5d2ed38f424b16ba914b85566c5277279d3f4e1743caa4f2e8d932d125ceb019479add38df49573ab42880ef103cf1c34
7
+ data.tar.gz: 7b8cceae4b29ff12e9e42fc51ee3b68ec5a1ae92122a91f35c6bb132f09edf1b5171785ef6494d3580e86da715218f1602f2ef8071a2e9b77b0e0123c28795ff
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.10.2] - 2026-04-08
4
+
5
+ ### Correcciones
6
+ - **RemoteError#to_s recursión infinita:** Corregir `SystemStackError` al invocar `to_s` en `BugBunny::RemoteError` en IRB. Antes, `to_s` llamaba a `message`, que en Ruby delega a `to_s`, generando recursión infinita. Ahora usa `super` para invocar `Exception#to_s` directamente. — @Gabriel
7
+
3
8
  ## [4.10.1] - 2026-04-08
4
9
 
5
10
  ### Correcciones
@@ -49,7 +49,7 @@ module BugBunny
49
49
 
50
50
  # @return [String] Representación legible de la excepción.
51
51
  def to_s
52
- "#{self.class.name}(#{original_class}): #{message}"
52
+ "#{self.class.name}(#{original_class}): #{super}"
53
53
  end
54
54
  end
55
55
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BugBunny
4
- VERSION = '4.10.1'
4
+ VERSION = '4.10.2'
5
5
  end
@@ -16,7 +16,8 @@ StandardError
16
16
  │ ├── BugBunny::Conflict (409)
17
17
  │ └── BugBunny::UnprocessableEntity (422)
18
18
  └── BugBunny::ServerError (5xx)
19
- └── BugBunny::InternalServerError (500+)
19
+ ├── BugBunny::InternalServerError (500+)
20
+ └── BugBunny::RemoteError (500)
20
21
  ```
21
22
 
22
23
  ## Errores de Infraestructura
@@ -83,6 +84,21 @@ end
83
84
  **Causa:** Cualquier error de servidor no mapeado a InternalServerError.
84
85
  **Resolución:** Similar a InternalServerError.
85
86
 
87
+ ### BugBunny::RemoteError (500)
88
+ **Causa:** Excepción no manejada en el controller remoto. El error se serializa y propaga al cliente RPC.
89
+ **Acceso a detalles:**
90
+ ```ruby
91
+ begin
92
+ client.request('users/42')
93
+ rescue BugBunny::RemoteError => e
94
+ e.original_class # String: clase original (ej: "TypeError")
95
+ e.original_message # String: mensaje original
96
+ e.original_backtrace # Array<String>: backtrace original
97
+ end
98
+ ```
99
+ **Serialización:** El controller captura excepciones con `rescue_from` → `handle_exception` → serializa con clase, mensaje y primeras 25 líneas del backtrace.
100
+ **Propagación:** El middleware `RaiseError` del cliente reconstituye `RemoteError` y la lanza localmente.
101
+
86
102
  ## Formato de Mensajes de Error
87
103
 
88
104
  El middleware `RaiseError` construye el mensaje así:
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe BugBunny::RemoteError do
6
+ subject(:error) do
7
+ described_class.new('TypeError', 'nil can\'t be coerced into Integer', [
8
+ "/app/controllers/services_controller.rb:5:in 'Integer#*'",
9
+ "/app/controllers/services_controller.rb:5:in 'ServicesController#index'"
10
+ ])
11
+ end
12
+
13
+ describe '#to_s' do
14
+ it 'does not cause infinite recursion (message -> to_s -> message)' do
15
+ expect(error.to_s).to eq("BugBunny::RemoteError(TypeError): nil can't be coerced into Integer")
16
+ end
17
+ end
18
+
19
+ describe '#message' do
20
+ it 'returns the formatted string without stack overflow' do
21
+ expect(error.message).to eq("BugBunny::RemoteError(TypeError): nil can't be coerced into Integer")
22
+ end
23
+ end
24
+
25
+ describe '#inspect' do
26
+ it 'is renderable by IRB without raising' do
27
+ expect { error.inspect }.not_to raise_error
28
+ end
29
+ end
30
+
31
+ describe '.serialize' do
32
+ it 'serializes an exception with class, message and backtrace' do
33
+ exception = TypeError.new('test error')
34
+ exception.set_backtrace(%w[line1 line2])
35
+
36
+ result = described_class.serialize(exception)
37
+
38
+ expect(result).to eq(class: 'TypeError', message: 'test error', backtrace: %w[line1 line2])
39
+ end
40
+
41
+ it 'truncates backtrace to max_lines' do
42
+ exception = TypeError.new('test')
43
+ exception.set_backtrace(Array.new(30) { |i| "line#{i}" })
44
+
45
+ result = described_class.serialize(exception, max_lines: 5)
46
+
47
+ expect(result[:backtrace].size).to eq(5)
48
+ end
49
+ end
50
+
51
+ describe 'attributes' do
52
+ it 'exposes the original exception class' do
53
+ expect(error.original_class).to eq('TypeError')
54
+ end
55
+
56
+ it 'exposes the original message' do
57
+ expect(error.original_message).to eq("nil can't be coerced into Integer")
58
+ end
59
+
60
+ it 'exposes the original backtrace' do
61
+ expect(error.original_backtrace.size).to eq(2)
62
+ end
63
+
64
+ it 'sets the Ruby backtrace to the remote backtrace' do
65
+ expect(error.backtrace).to eq(error.original_backtrace)
66
+ end
67
+ end
68
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bug_bunny
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.10.1
4
+ version: 4.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - gabix
@@ -288,6 +288,7 @@ files:
288
288
  - spec/unit/observability_spec.rb
289
289
  - spec/unit/otel_spec.rb
290
290
  - spec/unit/producer_spec.rb
291
+ - spec/unit/remote_error_spec.rb
291
292
  - spec/unit/request_spec.rb
292
293
  - spec/unit/resource_attributes_spec.rb
293
294
  - spec/unit/route_spec.rb
@@ -302,7 +303,7 @@ metadata:
302
303
  homepage_uri: https://github.com/gedera/bug_bunny
303
304
  source_code_uri: https://github.com/gedera/bug_bunny
304
305
  changelog_uri: https://github.com/gedera/bug_bunny/blob/main/CHANGELOG.md
305
- documentation_uri: https://github.com/gedera/bug_bunny/blob/v4.10.1/skill
306
+ documentation_uri: https://github.com/gedera/bug_bunny/blob/v4.10.2/skill
306
307
  post_install_message:
307
308
  rdoc_options: []
308
309
  require_paths: