Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
lls_program
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-09-19 13:22:55 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b5df25c72c389d0bf4d445a58403f740d89d5a53
b5df25c7
1 parent
7a3c1c0d
fix(api): 将错误提示从toast改为抛出异常
修改错误处理逻辑,将静默模式下的toast提示改为直接抛出异常,以便调用方能够捕获并处理错误
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
src/api/fn.js
src/api/fn.js
View file @
b5df25c
/*
* @Date: 2022-05-18 22:56:08
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-1
6 21:56:59
* @LastEditTime: 2025-09-1
9 13:12:14
* @FilePath: /lls_program/src/api/fn.js
* @Description: 文件描述
*/
...
...
@@ -28,11 +28,12 @@ export const fn = (api, options = {}) => {
console
.
warn
(
res
);
// 只有在非静默模式下才显示错误提示
if
(
!
silent
)
{
Taro
.
showToast
({
title
:
res
?.
data
?.
msg
||
'请求失败'
,
icon
:
'none'
,
duration
:
2000
});
// Taro.showToast({
// title: res?.data?.msg || '请求失败',
// icon: 'none',
// duration: 2000
// });
throw
new
Error
(
res
?.
data
?.
msg
||
'请求失败'
);
}
return
false
;
}
...
...
Please
register
or
login
to post a comment