mirror of
https://github.com/azure/login.git
synced 2026-06-08 22:47:11 +00:00
* Bump lodash from 4.17.15 to 4.17.19 (#52) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Amruta Kawade <65217380+AmrutaKawade@users.noreply.github.com> * Bump @actions/core from 1.1.3 to 1.2.6 (#60) Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.1.3 to 1.2.6. - [Release notes](https://github.com/actions/toolkit/releases) - [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Amruta Kawade <65217380+AmrutaKawade@users.noreply.github.com> * updating node_nodules * updated package-lock Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
49 lines
1.5 KiB
JavaScript
49 lines
1.5 KiB
JavaScript
/**
|
|
`rethrow` will rethrow an error on the next turn of the JavaScript event
|
|
loop in order to aid debugging.
|
|
|
|
Promises A+ specifies that any exceptions that occur with a promise must be
|
|
caught by the promises implementation and bubbled to the last handler. For
|
|
this reason, it is recommended that you always specify a second rejection
|
|
handler function to `then`. However, `rethrow` will throw the exception
|
|
outside of the promise, so it bubbles up to your console if in the browser,
|
|
or domain/cause uncaught exception in Node. `rethrow` will also throw the
|
|
error again so the error can be handled by the promise per the spec.
|
|
|
|
```javascript
|
|
import { rethrow } from 'rsvp';
|
|
|
|
function throws(){
|
|
throw new Error('Whoops!');
|
|
}
|
|
|
|
let promise = new Promise(function(resolve, reject){
|
|
throws();
|
|
});
|
|
|
|
promise.catch(rethrow).then(function(){
|
|
// Code here doesn't run because the promise became rejected due to an
|
|
// error!
|
|
}, function (err){
|
|
// handle the error here
|
|
});
|
|
```
|
|
|
|
The 'Whoops' error will be thrown on the next turn of the event loop
|
|
and you can watch for it in your console. You can also handle it using a
|
|
rejection handler given to `.then` or `.catch` on the returned promise.
|
|
|
|
@method rethrow
|
|
@public
|
|
@static
|
|
@for rsvp
|
|
@param {Error} reason reason the promise became rejected.
|
|
@throws Error
|
|
@static
|
|
*/
|
|
export default function rethrow(reason) {
|
|
setTimeout(() => {
|
|
throw reason;
|
|
});
|
|
throw reason;
|
|
}
|