This file contains 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 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 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 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 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 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 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 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 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) { |
This file contains 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
try { | |
const a = 1; | |
throw new Error('something went wrong..'); | |
const b = 2; | |
} catch (e) { | |
console.error(e); |
NewerOlder