This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Consumer } from 'sqs-consumer'; | |
const consumer = Consumer.create({ | |
queueUrl: 'some wrong queue url' | |
}); | |
consumer.on('error', err => { | |
console.error('Error in SQS consumer:', err); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onerror = (message) => { | |
console.log(`in window.onerror: ${message}`); | |
}; | |
new Promise((resolve, reject) => { | |
rj(new Error('some unhandeled promise rejection error')) | |
}); | |
throw new Error('some regular error'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async ()=> { | |
const TTL = 1000; // ms | |
const N = 4; | |
const foo = () => { | |
return new Promise((resolve, reject) => { | |
setTimeout(resolve, TTL); | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:angular.element(document.body).injector().get('$rootScope').$broadcast('player:controls:sfw:toggle') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async() => { | |
try { | |
new Promise((resolve, reject) => { | |
setTimeout(() => { | |
reject(new Error('something went wrong..')); | |
}, 0); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.put('/user/:id', async(req, res, next) => { | |
try { | |
// Find a user model in the Database | |
const user = await User.findById(req.params.id); | |
if (!user) { | |
const e = new Error('User not found'); | |
e.status = 404; | |
throw e; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('/user/:id', async(req, res) => { | |
const user = await User.findById(req.params.id); | |
if (!user) { | |
const e = new Error('User not found'); | |
e.status = 404; | |
throw e; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('/', async(req, res, next) => { | |
try { | |
const model = await Model.findById(req.params.id); | |
res.json(model); | |
} catch (e) { | |
next(e); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#someButton').click(async evt => { | |
const userId = $(evt.target).attr('data-user-id'); | |
const res = await axios.get(`/user/${userId}`); | |
// Assume that `render` function exists | |
render(res); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#someButton').click(async evt => { | |
try { | |
const userId = $(evt.target).attr('data-user-id'); | |
const res = await axios.get(`/user/${userId}`); | |
// Assume that `render` function exists | |
render(res); | |
} catch (e) { |
NewerOlder