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

增加异常处理相关功能 #275

Closed
ghost opened this issue Dec 20, 2019 · 4 comments
Closed

增加异常处理相关功能 #275

ghost opened this issue Dec 20, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Dec 20, 2019

吾有一疑。。。。。。。

@LingDong- LingDong- added the enhancement New feature or request label Dec 20, 2019
@Lotayou
Copy link

Lotayou commented Dec 20, 2019

@ijacksonliu @LingDong- Great suggestion. How does the following syntax appeal to you?

吾有一数。曰三。名之曰【被除数】。
吾有一数。曰零。名之曰【除数】。

吾有一疑。未知其可否。姑妄行之。
除【被除数】以【除数】。名之曰【商】
若此法不通。乃行补救之策。
警云【【谬矣!除数岂可为零乎?】】
吾有一数,曰【非数也】。名之曰【商】
终焉
乃得【商】。书之。

Python

dividend = 3
divisor = 0
try:
    quotient = dividend / divisor
except:
    raise(Warning('Divisor cannot be zero!))
    quotient = NaN
finally:
    print(quotient)

@LingDong-
Copy link
Member

@Lotayou Very appealing! I especially enjoy 姑妄行之.
Thanks!

@741111
Copy link

741111 commented Dec 21, 2019

可以使用:
尝——或有「错误类型」之误——
的方式来处理异常

@antfu
Copy link
Member

antfu commented Dec 30, 2019

Try-Catch is shipped in #399.
Closing now. If you got any questions, free feel to reopen it.

@antfu antfu closed this as completed Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants