Skip to content

Commit

Permalink
Add multiple errors endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
unflxw committed Jul 24, 2024
1 parent fa91415 commit 6bdb75d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions ruby/sinatra-puma/app/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<li><a href="/stream/slow?time=#{time}">Slow streaming request</a></li>
<li><a href="/stream/error?time=#{time}">Streaming request with error</a></li>
<li><a href="/heartbeat?time=#{time}">Custom heartbeat</a></li>
<li><a href="/errors?time=#{time}">Multiple errors with custom instrumentation</a></li>
</ul>
HTML
end
Expand All @@ -27,6 +28,31 @@
raise "error"
end

class SomeCustomError < StandardError
end

class AnotherCustomError < StandardError
end

get "/errors" do
transaction = Appsignal::Transaction.current

[SomeCustomError, AnotherCustomError, StandardError].each do |cls|
begin
raise cls.new("I am one of multiple errors")
rescue => e
transaction.add_error(e)
end
end

Appsignal.set_custom_data({
"time" => Time.now.to_s,
"custom" => "data"
})

"Errors sent!"
end

get "/stream/slow" do
stream do |out|
sleep 1
Expand Down

0 comments on commit 6bdb75d

Please sign in to comment.