Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FSM 内部执行外部函数出现异常时不应崩溃 #616

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

AzideCupric
Copy link
Collaborator

避免因网络不佳等原因使 action 抛出异常导致 FSM 异常终止

Copy link

netlify bot commented Aug 19, 2024

Deploy Preview for nonebot-bison ready!

Name Link
🔨 Latest commit 597f84d
🔍 Latest deploy log https://app.netlify.com/sites/nonebot-bison/deploys/66c35aa7c5e894000832fab1
😎 Deploy Preview https://deploy-preview-616--nonebot-bison.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Aug 19, 2024

Deploy Preview for nonebot-bison ready!

Name Link
🔨 Latest commit 2d54625
🔍 Latest deploy log https://app.netlify.com/sites/nonebot-bison/deploys/66e752253eecba0008f7ec95
😎 Deploy Preview https://deploy-preview-616--nonebot-bison.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Aug 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.64%. Comparing base (68f7e3b) to head (2d54625).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #616      +/-   ##
==========================================
+ Coverage   85.45%   85.64%   +0.19%     
==========================================
  Files          91       91              
  Lines        4793     4822      +29     
==========================================
+ Hits         4096     4130      +34     
+ Misses        697      692       -5     
Flag Coverage Δ
smoke-test 85.64% <100.00%> (+0.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@felinae98
Copy link
Collaborator

是不是应该在每个 action 里处理错误处理,在外层如果检测到发生错误就直接 reset

@AzideCupric
Copy link
Collaborator Author

是不是应该在每个 action 里处理错误处理,在外层如果检测到发生错误就直接 reset

reset与否我认为应该让具体的使用场景抉择,而不是包办

@felinae98
Copy link
Collaborator

这样,默认的行为是 exception 之后 fsm 报错。然后外面包一个 wrapper?如果发生错误就创建新的 fsm

Comment on lines 122 to 126
def __init__(self, graph: StateGraph[TState, TEvent, TAddon], addon: TAddon): ...

@overload
def __init__(self, graph: StateGraph[TState, TEvent, TAddon], addon: TAddon, *, transfer_anyway: bool = ...):
"""if, transfer_anyway` is True,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是不是不 overload 也可以

@felinae98 felinae98 added the bug Something isn't working label Sep 17, 2024
@felinae98 felinae98 changed the title 🐛 FSM 内部执行外部函数出现异常时不应崩溃 FSM 内部执行外部函数出现异常时不应崩溃 Sep 17, 2024
@felinae98 felinae98 merged commit 088e7a4 into main Sep 17, 2024
35 checks passed
@felinae98 felinae98 deleted the fix/fsm-except branch September 17, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants