move createError helper to flash/util.js