- May 2023
-
www.desiringgod.org www.desiringgod.org
-
“My God will supply every need of yours according to his riches in glory in Christ Jesus.”
The many poor and homeless would beg to differ, here.
How many people die because they can't afford their life-saving medicines (while the pharmaceutical companies make record profits)?
-
He will give us “all things.”
That's sound logic, but there's no evidence of an actual God actually giving "all things" to any people, let alone his followers.
Notice how Dr. Piper realizes he needs to qualify this promise, in the next paragraphs, by explaining that "all things" doesn't really mean all things!
-
If you don’t have the resources to do it, he doesn’t expect you to do it.
This is a very common cop-out, throughout the Bible. A grand promise is made, and then an all-encompassing excuse is tacked on to explain that anytime the promise is unmet, it means the promise doesn't apply.
-
- Mar 2023
-
jacobin.com jacobin.com
-
Yet we shouldn’t act as if there is zero reason for Biden’s turnabout. He understands, like every president before him, that surging gasoline prices are an enormous political liability in a society where the vast majority of workers still require the dirty fuel to get to work. As long as Biden acts as if his administration is helpless in the face of fossil fuel price volatility — and only increased supply will bring the price down — political viability will continue to hinge on cheap fossil fuel prices.
- The hands of politicians are always bound.
- by the fossil fuel interests that power the ordinary person's lives
- The current dependency of the ordinary person on fossil fuels
- is still the greatest barrier to system change.
- The hands of politicians are always bound.
-
-
blog.oup.com blog.oup.com
-
In the new collection, The Good It Promises, The Harm It Does, activists and scholars address the deeper problems that EA poses to social justice efforts. Even when EA is pursued with what appears to be integrity, it damages social movements by asserting that it has top-down answers to complex, local problems, and promises to fund grass-roots organizations only if they can prove that they are effective on EA’s terms.
- Comment
- The book title is a perfect taking to introduce the concept of progress traps, of which effective altruism appears to be.
-
- Apr 2022
-
localhost:4000 localhost:4000
-
Because promise handlers aren’t immediately executed, you might imagine that they act a little like timers — giving the browser a chance to repaint and perform other important tasks before the handler is executed.
is this because callbacks go into the callback queue ie. lower priority than the microtask queue ?
promises and mutation observer go into the microtask queue and have higher higher priority, are DOM mutations the "important tasks" that James is refering to ??
-
In fact, promises aren’t like timers at all. If there are any promise handlers waiting to be executed when your script completes, they’ll be executed immediately.
is this because promises go into the microtask queue ( higher priority than the callback queue ) ??
-
rejection handler for then()
this is also applicable tor .catch() . since catch() is just a special case of .then() ie. .then(null , failure handler). Check the description of promise.catch in the "A Spoonful of Sugar" chapter.
-
- Feb 2022
-
-
- Jan 2022
-
-
NODE_OPTIONS=--unhandled-rejections=none node
-
-
javascript.info javascript.info
-
new Promise(function(resolve, reject) { setTimeout(() => { throw new Error("Whoops!"); }, 1000); }).catch(alert);
-
we should have the unhandledrejection event handler (for browsers, and analogs for other environments) to track unhandled errors and inform the user (and probably our server) about them, so that our app never “just dies”.
-
What happens when a regular error occurs and is not caught by try..catch? The script dies with a message in the console. A similar thing happens with unhandled promise rejections.
-
-
blog.atomist.com blog.atomist.com
-
My gut told me calling an async function from the setTimeout callback was a bad thing. Since the setTimeout machinery ignores the return value of the function, there is no way it was awaiting on it. This means that there will be an unhandled promise. An unhandled promise could mean problems if the function called in the callback takes a long time to complete or throws an error.
-
The callback executed by setTimeout is not expected to return anything, it just ignores the returned value. Since once you enter the promise/async world in JavaScript you cannot escape, I was left to wonder what happens when the setTimeout callback returns a promise?
-
-
stackoverflow.com stackoverflow.com
-
test2 being marked async does wrap your return value in a new promise:
-
const rejectedP = Promise.reject('-'); const finallyP = rejectedP.finally(); const result1 = rejectedP; const result2 = new Promise(resolve => { const rejectedP = Promise.reject('-'); const finallyP = rejectedP.finally(); resolve(rejectedP); }); we can see that the first snippet creates two promises (result1 and rejectedP being the same) while the second snippet creates three promises. All of these promises are rejected, but the rejectedP rejection is handled by the callbacks attached to it, both through ….finally() and resolve(…) (which internally does ….then(resolve, reject)). finallyP is the promise whose rejection is not handled in the both examples. In the second example, result2 is a promise distinct from rejectedP that is also not handled, causing the second event.
-
-
stackoverflow.com stackoverflow.com
-
You basically did var a = promise.then(…); var b = promise.catch(…); creating a branch in the chain. If promise is getting rejected now, the catch callback will be called and b will be a fulfilled promise just fine, but the a promise is getting rejected too and nobody handles that. Instead, you should use both arguments of then and write Requirement.create({id: id, data: req.body.data, deleted: false}) .then(requirement => { res.json(requirement); }, reason => { let err = {'error': reason}; res.json(err); });
-
-
-
Just "ignoring" a Promise result if it is not longer needed is an antipattern in my opinion.
-
-
github.com github.com
-
Fundamentally, I think promise rejection is substantially different than "throwing" under normal synchronous flow.
-
const promise = Promise.reject(new Error("Something happened!")); setTimeout(async () => { // You want to process the result here... try { const result = await promise; console.log(`Hello, ${result.toUpperCase()}`) } // ...and handle any error here. catch (err) { console.error("There was an error:", err.message); } }, 100);
-
-
www.npmjs.com www.npmjs.comco1
-
Generator based control flow goodness for nodejs and the browser, using promises, letting you write non-blocking code in a nice-ish way.
Tags
Annotators
URL
-
-
thecodebarbarian.com thecodebarbarian.com
-
There are a lot of nasty gotchas with unhandled rejections. That's why Node.js gives you a mechanism for globally handling unhandled rejections.
-
- Jul 2021
-
ayjay.org ayjay.org
-
“!e ‘projecting’ of‘futurologists’ uses the future as the safest possible context forwhatever is desired; it binds one only to selfish interest. But makinga promise binds one to someone else’s future.”
This is part of why Mark Zuckerberg's promises to "do better in the future" are wholly unbelievable and disingenuous.
-
- Feb 2021
-
-
An async function simply implies that a promise will be returned and if a promise is not returned, JavaScript will automatically wrap it in a resolved promise with the return value in that function. That would look like writing return Promise.resolve(‘hello’)
-
- Oct 2020
-
final-form.org final-form.org
-
Returns a Promise<?Object> that resolves with no value on success or resolves with an Object of submission errors on failure. The reason it resolves with errors is to leave rejection for when there is a server or communications error.
-
-
github.com github.com
-
Another example:
const expensiveOperation = async (value) => { // return Promise.resolve(value) // console.log('value:', value) await sleep(1000) console.log('expensiveOperation: value:', value, 'finished') return value } var expensiveOperationDebounce = debounce(expensiveOperation, 100); // for (let num of [1, 2]) { // expensiveOperationDebounce(num).then(value => { // console.log(value) // }) // } (async () => { await sleep(0 ); console.log(await expensiveOperationDebounce(1)) })(); (async () => { await sleep(200 ); console.log(await expensiveOperationDebounce(2)) })(); (async () => { await sleep(1300); console.log(await expensiveOperationDebounce(3)) })(); // setTimeout(async () => { // console.log(await expensiveOperationDebounce(3)) // }, 1300)
Outputs: 1, 2, 3
Why, if I change it to:
(async () => { await sleep(0 ); console.log(await expensiveOperationDebounce(1)) })(); (async () => { await sleep(200 ); console.log(await expensiveOperationDebounce(2)) })(); (async () => { await sleep(1100); console.log(await expensiveOperationDebounce(3)) })();
Does it only output 2, 3?
-
-
codesandbox.io codesandbox.io
-
- Sep 2020
-
stackoverflow.com stackoverflow.com
-
Your problem is that you were returning the rejected loginDaoCall, not the promise where the error was already handled. loginApi.login(user, password) did indeed return a rejected promise, and even while that was handled in another branch, the promise returned by the further .then() does also get rejected and was not handled.
-
// LoginApi.js return loginDao.login(username, password).then(function (res) { store.dispatch(loginSuccess()); log.log("[loginApi.login] END"); return true; }, function (err) { store.dispatch(loginFail()); errorUtils.dispatchErrorWithTimeout(errorLogin); log.log(err); return false; }); // never supposed to reject
-
-
javascript.info javascript.info
-
The "invisible try..catch" around the executor automatically catches the error and turns it into rejected promise.
-
-
stackoverflow.com stackoverflow.com
-
This treatment of thenables allows promise implementations to interoperate, as long as they expose a Promises/A+-compliant then method. It also allows Promises/A+ implementations to “assimilate” nonconformant implementations with reasonable then methods.
-
the promise specification explicitly does not make a distinction
-
-
github.com github.com
-
This isn't really a bug, because if you have an async function that returns a function, it doesn't really return a function - it returns a promise. I don't remember whether the Svelte internals currently check for the onMount callback's return being a function or whether they check for it being truthy. Maybe there's some adjustment to be made there.
-
-
www.coreycleary.me www.coreycleary.me
-
-
The error callback becomes a reject, while the "happy path" callback becomes a resolve.
-
-
developer.mozilla.org developer.mozilla.org
-
Here we store the three Promise objects in variables, which has the effect of setting off their associated processes all running simultaneously. Next, we await their results — because the promises all started processing at essentially the same time, the promises will all fulfill at the same time
-
-
-
.catch(error => download_count = error) // check for error in template
-
Making the value change to a Promise for the duration would be more fitting for many uses.
-
- May 2020
-
developer.mozilla.org developer.mozilla.orgPromise4
-
The promises of a chain are nested like Russian dolls, but get popped like the top of a stack.
-
Similarly, .catch() is really just a .then() without a slot for handleFulfilled.
-
in the absence of an immediate need, it is simpler to leave out error handling until a final .catch() statement.
-
Handling a rejected promise too early has consequences further down the promise chain. Sometimes there is no choice, because an error must be handled immediately.
-
- Mar 2020
-
plato.stanford.edu plato.stanford.edu
-
The remedy which the tradition of Western thought has proposed for the unpredictability and irreversibility of action has consisted in abstaining from action altogether, in the withdrawal from the sphere of interaction with others, in the hope that one’s freedom and integrity could thereby be preserved. Platonism, Stoicism and Christianity elevated the sphere of contemplation above the sphere of action, precisely because in the former one could be free from the entanglements and frustrations of action. Arendt’s proposal, by contrast, is not to turn one’s back on the realm of human affairs, but to rely on two faculties inherent in action itself, the faculty of forgiving and the faculty of promising. These two faculties are closely connected, the former mitigating the irreversibility of action by absolving the actor from the unintended consequences of his or her deeds, the latter moderating the uncertainty of its outcome by binding actors to certain courses of action and thereby setting some limit to the unpredictability of the future. Both faculties are, in this respect, connected to temporality: from the standpoint of the present forgiving looks backward to what has happened and absolves the actor from what was unintentionally done, while promising looks forward as it seeks to establish islands of security in an otherwise uncertain and unpredictable future.
-