Releases: asmsh/promise
Releases · asmsh/promise
v0.4.1
Some breaking changes toward a more prod-ready behavior
BREAKING
- Changed the behaviour of the
Wait
andGetRes
methods to make them, when called on a promise, responsible for theUnCaughtErr
panics and the non-recovered panics, instead of creating these panics from each promise's goroutine, which prevented these panics from being recovered in the calling goroutine. - Changed the behaviour of panicking for non-recovered promises to only happen in the Safe mode.
So now, in the NonSafe mode, all calls will not panic when their promises' panic and are not recovered, in addition to already not panicking for un-caught errors(UnCaughtErr
). - Changed the behaviour of the
GetRes
method to make it able to handle rejected promises and preventUnCaughtErr
panics, in the Safe mode. - Deprecated the
GetErr
andIsErrRes
methods of theRes
type, in preparation for their removal in the next minor release. - Removed the deprecated
WaitUntil
andGetResUntil
methods from thePromise
interface and theGoPromise
implementation. The same functionality can be achieved using thechan
returned from theWaitChan
method, atime.Timer
, and aselect
statement. - Changed the error message(the return of the Error method) of the
UnCaughtErr
type.
Improvements
- Added new method to the
Res
type,Err
, which replaces the deprecated methodsGetErr
andIsErrRes
.
Other
- Updated some of the docs.
v0.3.0
BREAKING
- Changed the behaviour of passing 'nil'
error
value to the 'Reject' constructor to return a Fulfilled promise, instead of a Rejected one. - All constructors that accept a function will now panic if a 'nil' function is passed. The panic will now happen when passing the 'nil' function, instead of when calling it, and hence, the panic value is changed to be relative to this package.
- Deprecated the 'WaitUntil' and the 'GetResUntil' methods, in preparation for their removal in the next minor release.
Improvements
- Added a new constructor, 'Delay', which returns a promise that will be resolved to the provided 'Res' value after a delay.
- Added a new method, 'Delay', to the 'Promise' interface and the 'GoPromise' implementation, which returns a promise that will be resolved to the same value after a delay.
- Added a new type, 'Status', which represents the status of a single promise at the moment.
- Added a new method, 'Status', to the 'Promise' interface and the 'GoPromise' implementation, which returns a value of type 'Status'.
Other
- Updated some of the docs.
- Added new test cases and benchmarks.
- Added new example.
v0.2.0
Some fixes to the docs
Fixes:
- Fixed the docs of the
WaitUntil
and theGetResUntil
methods to describe their actual behavior(such that the passed duration is not the max wait duration, but the min wait duration)
v0.1.1
Fixes:
- In the Resolver constructor, any panic that happens after the promise is resolved(after calling fulfill or reject), will not be recovered
- For promises created from the New constructor, panic, as expected, if two or more values are sent on the channel, after the promise is Resolved
Improvements
- Updated the docs
- Other small internal improvements
Initial release
v0.1.0 Updated the README file