Files
hdk-core/publish/languages/en/common_error.php
李东云 55da02080e feat(exception): 新增业务错误处理和 API 迁移支持
- 新增业务错误类型和相关错误码
- 实现 API 迁移异常处理
- 增加未实现功能异常处理
- 更新错误处理逻辑,支持新错误类型

Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2025-08-02 18:35:31 +08:00

174 lines
6.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
return [
// 系统错误或未预期的错误
'server_error' => 'An internal error is occurred, try again later',
'program' => [
'default' => 'An internal error is occurred, try again later',
'syntax' => [
'default' => 'An internal error is occurred, try again later',
],
'sql' => [
'default' => 'An internal error is occurred, try again later',
'column_not_found' => 'An internal error is occurred, try again later',
'insert' => 'An internal error is occurred, try again later',
'update' => 'An internal error is occurred, try again later',
'delete' => 'An internal error is occurred, try again later',
],
],
// 参数校验
'params' => [
'method' => [
'default' => 'Reject request',
],
// 参数非法
'format_error' => 'Format error :param',
// 数据错误
'error' => [
'default' => 'Failed verification',
'user' => [
'default' => 'Format error, :reason',
'sec_email' => [
'unique' => 'Oops! This email address is already used',
'required' => '请传入安全邮箱',
'undefined' => '请先绑定',
],
'sec_phone' => [
'unique' => 'Oops! This phone is already used',
'required' => '请传入安全手机号码',
'undefined' => '请先绑定',
],
'username' => [
'unique' => 'Oops! This username is already used',
],
'sign_up' => [
'default' => 'An account with this email or phone already exists.',
],
'action' => [
'error' => 'This type of verification code is unexpected',
],
],
'code' => [
'error' => 'This verification code is incorrect or expired',
'timeout' => 'This verification code is incorrect or expired',
'limit' => [
'default' => 'SMS verification code has reached the upper limit today, please come back tomorrow. Any problem, please contact our customer service.',
'day' => 'SMS verification code has reached the upper limit today, please come back tomorrow. Any problem, please contact our customer service.',
'hour' => 'SMS verification code has reached the upper limit today, please come back tomorrow. Any problem, please contact our customer service.',
'minute' => 'Try again later',
],
],
'target' => [
'format' => 'Invalid Target URL',
'missing' => 'Missing Target URL',
],
],
],
// 鉴权
'auth' => [
'default' => 'Please login',
'jwt' => [
'default' => 'Please login',
'iat' => 'Processing, try again later',
'nbf' => 'Processing, try again later',
'exp' => 'Please login',
'iss' => 'Please login',
'uid' => 'Please login',
],
'session' => [
'default' => 'Please login',
'uid' => 'Please login',
'created_at' => 'Please login',
],
'forbidden' => [
'default' => 'You don\'t have permission to manipulate this content',
'read' => [
'default' => 'You don\'t have permission to manipulate this content',
],
'update' => [
'default' => 'You don\'t have permission to manipulate this content',
'address' => [
'unique' => 'You need at least one default shipping address',
],
],
'create' => [
'default' => 'You don\'t have permission to manipulate this content',
'wechat' => [
'redundant' => 'Oops! This WeChat is already used',
],
],
'delete' => [
'default' => 'You don\'t have permission to manipulate this content',
'wechat' => [
'only' => 'You need to add phone or email before unbind WeChat.',
],
],
],
'app' => [
'default' => 'Please login',
]
],
// 服务出错
'server' => [
'cache' => [
'redis' => [
'default' => 'OopsSomething went wrong and it was probably our fault. Please try again, or report the problem to us.',
'refused' => 'OopsSomething went wrong and it was probably our fault. Please try again, or report the problem to us.',
],
],
'dependency' => [
'sms' => [
'default' => 'OopsSomething went wrong and it was probably our fault. Please try again, or report the problem to us.',
],
'wechat' => [
'default' => 'Please refresh the QR code and scan the code again',
'code' => 'An internal error is occurred, try again later',
'timeout' => 'An internal error is occurred, try again later',
],
],
'message' => [
'email' => [
'default' => 'Email send error.',
'not_found' => 'Incorrect Email',
],
],
],
'not_found' => [
'route' => [
'default' => 'The route does not exist',
],
],
// 模型
'model' => [
'not_found' => 'Resource Error',
'user' => [
'default' => 'Invalid User',
'not_valid' => 'The username or password is incorrect',
],
'document' => [
'default' => 'DOC deleted',
],
],
// 业务错误
'business' => [
'default' => 'Business Error',
'old_version' => 'This feature is not available in the current version.',
'not_implemented' => 'This feature is not implemented yet.',
],
];