Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

在抛出异常时可以加入一个默认的code吗 #6

@jeekman2026

Description

@jeekman2026

public static function check(string $key, int $limit, int $ttl, string $message = 'Too Many Requests'): void { $key = static::$prefix . '-' . $key; if (static::$driver->increase($key, $ttl) > $limit) { throw new RateLimitException($message,429); } }
当自定义异常处理的时候如果这里不给默认的code,异常接收到是0,导致业务错误码不正确

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions