View migration_file_with_error.rb
1 2 3 4 5 6 7 8 9
class SetupHstore < ActiveRecord::Migration
def up
execute "CREATE EXTENSION IF NOT EXISTS hstore"
end
 
def down
execute "DROP EXTENSION IF EXISTS hstore"
end
end
View homebrew segfault due to readline
1 2 3 4 5 6 7 8 9 10
➜ ~ brew upgrade wget
 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/readline.bundle: [BUG] Segmentation fault
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]
 
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
View consumer.es.js
1
export {Worker} from './package';
View next in yielded method.es.js
1 2 3 4 5 6 7 8 9 10
let price = 10;
 
let stockPrice = function () {
setTimeout(function() {
iterator.next(price++);
}, 300);
}
 
let badStockPrice = function () {
iterator.next(price++);
View wrap_errors_for_generators.es.js
1 2 3 4 5 6 7 8 9 10
// works: https://gist.github.com/deepak/ffe01c81900d12f95658
// does not work: https://gist.github.com/deepak/9a7337d7a641f8af9c8b
 
// difference is that, if error is thrown directly from fucntion called in generator
// then it gives a "Generator is already running" error
// but if it is wrapped in a setTimeout callback then it works
 
// WORKS
 
let price = 10;
View errors_in_generator.es.js
1 2 3 4 5 6 7 8 9 10
let price = 10;
 
let stockPrice = function () {
setTimeout(function() {
iterator.next(price++);
}, 300);
}
 
let errorInStockPrice = function() {
setTimeout(function() {
View get_stock_price.es.js
1 2 3 4 5 6 7 8 9 10
let price = 10;
 
let stockPrice = function () {
setTimeout(function() {
iterator.next(price++);
console.log(price); //=> 10
// why is this logged ? next does not behave like return ?
// and it is always 10. "price++" did not increment value of price
}, 300);
}
View generator.es.js
1 2 3 4 5 6 7 8 9 10
let price = 10;
 
let stockPrice = function () {
// iterator.next(price++); // throws a "Generator is already running" error
return price++
}
 
let oops = function () {
throw new Error("oops!");
}
View cannot throw error in generator.debug.txt
1 2 3 4
works if generator is not calling another function ?
 
example from http://davidwalsh.name/es6-generators-dive
similar example at https://gist.github.com/deepak/9a7337d7a641f8af9c8b
View error_in_generator.es.js
1 2 3 4 5 6 7 8 9 10
function getStockPrice() {
seq.throw('oops! could not get stock price');
// seq.next(80);
}
 
function executeTrade() {
setTimeout(function() {
console.log("trade done");
seq.next(true);
}, 300);
Something went wrong with that request. Please try again.