kevinhwang91
119e896101
ci: try to fix macos-latest action
...
macos-latest is arm64 now
2024-08-05 07:17:21 +08:00
kevinhwang91
512b9c8504
test(error): fix lua 5.1 error
2024-08-05 07:16:58 +08:00
kevinhwang91
407880a65e
refactor(error): pop xpcall stack obviously
2024-08-05 07:16:23 +08:00
kevinhwang91
038d05664f
test(error): add inner error tests
2024-08-03 23:59:52 +08:00
kevinhwang91
dc76b9dc88
refactor(error): rework inner error
2024-08-03 23:59:52 +08:00
kevinhwang91
6293b22a55
test(loop): improve nextIdle test
2024-08-03 03:17:27 +08:00
kevinhwang91
4a67a0008d
fix(spec): no need to handle rejection for promise.reject
2024-08-01 22:57:57 +08:00
kevinhwang91
c0f8ee7163
refactor(loop): remove unnecessary start method
2024-08-01 00:20:52 +08:00
kevinhwang91
27652b4936
fix: throw error directly in luv loop
2024-08-01 00:20:52 +08:00
kevinhwang91
28c1d5a295
ci: update github action
2024-06-10 18:13:36 +08:00
kevinhwang91
32e9895d83
ci: update macos url for github action
2024-06-10 18:06:31 +08:00
kevinhwang91
988bc7fa16
ci: check.json
exist even no problem
2024-06-10 18:05:19 +08:00
kevinhwang91
93540c168c
fix(promise): only cache if error message is string
2024-02-27 21:44:26 +08:00
kevinhwang91
be4d4be215
fix(promise): promise shouldn't wrapper error
...
Just cache error to throw `UnhandledPromiseRejection`
2024-02-27 21:09:58 +08:00
Kevin Hwang
274edb0719
Merge pull request #6 from wookayin/error-handling
...
fix: do not lose stacktrace on errors when rejecting a promise
2024-02-27 15:12:29 +08:00
kevinhwang91
61f5736123
Merge branch 'main' into error-handling
2024-02-27 15:05:42 +08:00
kevinhwang91
17ab3826b2
fix: return PromiseAsyncError
rather than error stack
2024-02-27 15:04:00 +08:00
kevinhwang91
81a9878a76
fix(async): simplify setfenv
function
2024-02-27 14:54:32 +08:00
kevinhwang91
e8d3271195
fix(compat): simplify _xpcall
function
2024-02-27 08:21:04 +08:00
kevinhwang91
9d5d173f81
fix(typings): onRejected
in catch
return a val or promise
2024-02-27 08:18:44 +08:00
Jongwook Choi
dcfe539bdd
fix: do not lose stacktrace on errors when rejecting a promise
...
Problem: When a error happens while executing an asynchornous promise,
stacktrace information is lost. This makes debugging very difficult.
e.g.,
```
Error executing vim.schedule lua callback: UnhandledPromiseRejection with the reason:
...foo.lua: an error message
```
Solution: `pcall` will result in losing stacktrace. Use `xpcall` to
retain stacktrace information and use that for building error messages.
e.g.,
```
Error executing vim.schedule lua callback: UnhandledPromiseRejection with the reason:
...foo.lua:42: an error message
stack traceback:
...foo.lua💯 in function ...
...foo.lua:200: in function ...
[C]: in function ...
```
2024-02-03 23:52:50 -05:00
kevinhwang91
94f6f03c6c
chore: improve annotation and diagnostic
2023-11-28 17:53:33 +08:00
kevinhwang91
e94f35161b
ci: clean up github action
2023-04-09 18:59:31 +08:00
kevinhwang91
7fa127fa80
chore: update date of license
2023-02-01 18:08:22 +08:00
kevinhwang91
842dca33e6
build: create 1.0-0.rockspec
2023-01-05 21:13:47 +08:00
kevinhwang91
38a4575da9
docs: update permalink of demo
2023-01-05 21:00:44 +08:00
kevinhwang91
3f6dcb2f0f
fix!: use promise:new instead of promise.new
...
In Lua convention, create an object always carry `self`, so we must
break change for further development.
Create an promise object:
```lua
local p = promise:new(function(resolve, reject) end)
-- or
local p = promise(function(resolve, reject) end)
```
2023-01-05 20:50:52 +08:00
kevinhwang91
25ac2ddb57
ci: update github action
2022-12-23 21:38:58 +08:00
kevinhwang91
dc8d514bf9
chore: update annotation
2022-12-23 21:38:46 +08:00
kevinhwang91
70b09063cd
fix(promise): improve reason for unhandled rejection
...
Error in Lua is messy because of the `errfunc` in `lua_pcall`.
1. If reject reason by Promise, only append UnhandledPromiseRejection header;
2. If invoke error() in a function, prefer use the result caught by `pcall`
as reason for UnhandledPromiseRejection.
2022-09-20 12:36:26 +08:00
kevinhwang91
005df1ae44
fix(error): should respect __tostring
2022-07-28 16:35:34 +08:00
kevinhwang91
3fac3a5a3e
fix(promise): Neovim platform require
is fragile
2022-07-15 13:01:10 +08:00
kevinhwang91
32ec5e9c1a
fix(typings): finally return new promise
2022-07-15 12:59:09 +08:00
kevinhwang91
bd9956e9e4
chore(github): update neovim version
2022-07-13 14:41:12 +08:00
kevinhwang91
4c4447cacb
chore: fix new diagnostics
2022-07-13 14:25:27 +08:00
kevinhwang91
6cfa331bb9
fix!: Promise.finally should be same behavior with JavaScript
2022-07-13 14:22:54 +08:00
kevinhwang91
41f682c99f
chore: add ID to modules
2022-07-13 14:21:51 +08:00
kevinhwang91
1a30ecd708
chore: update typings and doc
2022-06-09 01:24:08 +08:00
kevinhwang91
9cd1dc9cd3
chore: fix github issue template
2022-05-26 14:03:17 +08:00
kevinhwang91
7e3a390c4f
docs: fix mistake
2022-05-20 16:58:14 +08:00
kevinhwang91
bf83a52716
fix(promise): throw first error from onFinally queue
2022-05-20 16:26:41 +08:00
kevinhwang91
7dbd73f3d9
fix(promise): call __newindex unnecessarily
2022-05-20 15:31:35 +08:00
kevinhwang91
38a4e1a31f
refactor(async): for injectENV
2022-05-20 15:21:21 +08:00
kevinhwang91
91bb52aa3c
test(async): avoid redundant await
2022-05-20 15:18:26 +08:00
kevinhwang91
0666ae3bbe
perf(promise): avoid to use unpack
2022-05-20 14:48:20 +08:00
kevinhwang91
3e075c362b
docs: improve document
2022-05-19 18:17:50 +08:00
kevinhwang91
1d11b7c07f
test(async): better multiple return values
2022-05-19 18:02:49 +08:00
kevinhwang91
b0871c94e0
perf(async): avoid unnecessary pack/unpack
2022-05-19 14:06:44 +08:00
kevinhwang91
b76eb14cbc
docs: update README
2022-05-19 04:26:27 +08:00
kevinhwang91
8177d6e6ab
fix: redundant await in demo
2022-05-19 04:24:15 +08:00