Skip to content

fix: correct RateLimiter.start_under_sentry_supervisor/2 spec - #1248

Open
lukaszsamson wants to merge 1 commit into
getsentry:masterfrom
lukaszsamson:fix-rate-limiter-spec
Open

lukaszsamson wants to merge 1 commit into
getsentry:masterfrom
lukaszsamson:fix-rate-limiter-spec

Conversation

@lukaszsamson

Copy link
Copy Markdown

Found with SpecLint on elixir 1.20.4

lib/sentry/logger_handler/rate_limiter.ex:16: warning: Sentry.LoggerHandler.RateLimiter.start_under_sentry_supervisor/2: inferred return includes :ok, which the spec does not declare
    @spec start_under_sentry_supervisor(
  id(),
  keyword()
) :: Supervisor.on_start_child()
    inferred: (atom(), empty_list() or non_empty_list(term(), term())) -> dynamic(:ok or {:error, not {:already_started, term()}})

The function maps Supervisor.start_child/2 results to :ok (including {:error, {:already_started, _}}) or {:error, reason}, so it never returns {:ok, pid}; the spec now says :ok | {:error, term()}. Spec-only change; no CHANGELOG entry since it is generated at release time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant