diff --git a/.changesets/ignore-hanami-errors-by-default.md b/.changesets/ignore-hanami-errors-by-default.md new file mode 100644 index 00000000..6df18970 --- /dev/null +++ b/.changesets/ignore-hanami-errors-by-default.md @@ -0,0 +1,13 @@ +--- +bump: patch +type: change +--- + +Ignore these Hanami errors by default: + +- Hanami::Router::NotAllowedError (for example: sending a GET request to POST endpoint) +- Hanami::Router::NotFoundError + +They are usually errors you don't want to be notified about, so we ignore them by default now. + +Customize the `ignore_errors` config option to continue receiving these errors. diff --git a/lib/appsignal/loaders/hanami.rb b/lib/appsignal/loaders/hanami.rb index 6356bbd6..976b642f 100644 --- a/lib/appsignal/loaders/hanami.rb +++ b/lib/appsignal/loaders/hanami.rb @@ -9,7 +9,11 @@ def on_load hanami_app_config = ::Hanami.app.config register_config_defaults( :root_path => hanami_app_config.root.to_s, - :env => hanami_app_config.env + :env => hanami_app_config.env, + :ignore_errors => [ + "Hanami::Router::NotAllowedError", + "Hanami::Router::NotFoundError" + ] ) end diff --git a/spec/lib/appsignal/loaders/hanami_spec.rb b/spec/lib/appsignal/loaders/hanami_spec.rb index de14fde2..4a09dc72 100644 --- a/spec/lib/appsignal/loaders/hanami_spec.rb +++ b/spec/lib/appsignal/loaders/hanami_spec.rb @@ -8,7 +8,12 @@ :name => :hanami, :root_path => Dir.pwd, :env => :test, - :options => {} + :options => { + :ignore_errors => [ + "Hanami::Router::NotAllowedError", + "Hanami::Router::NotFoundError" + ] + } ) end end