dkimot
dkimot

Reputation: 2289

What is superclass mismatch in Crystal Lang?

I am trying to implement a rate-limiting handler with Kemal.

I have a class, RateLimiter, that inherits the class Kemal::Handler. On compile I get the error:

Error in src/rate_limiter.cr:5: superclass mismatch for class RateLimiter (Kemal::Handler for Reference)

I'm new to Crystal and that means nothing to me. What am I doing wrong?

Upvotes: 3

Views: 155

Answers (1)

Jonne Haß
Jonne Haß

Reputation: 4857

This indicates that RateLimiter was defined previously somewhere, without any explicit superclass specification:

class Base; end
class Foo; end
class Foo < Base; end

That gives

Error in line 3: superclass mismatch for class Foo (Base for Reference)

https://carc.in/#/r/3r2l

Search through your project and dependencies for class RateLimiter giving conflicting definitions of that type.

Upvotes: 6

Related Questions