#1981·kitex

fix: RegisterService should return errors instead of panic

Author: lxcxjxhxCreated Jul 30, 2026Updated Jul 30, 2026

Problem

The RegisterService method in server/server.go declares error in its return signature but uses panic() for all parameter validation errors instead of returning errors properly.

Current Behavior

The method uses panic() for validation errors, violating Go error handling best practices.

Expected Behavior

The method should return errors via the declared error return value.

Proposed Fix

Replace panic() calls with return errors.New(...) to match the method's error return contract.