pass error back to sync callback #78

Merged
neb-b merged 1 commit from password into master 2020-01-03 21:33:50 +01:00
2 changed files with 4 additions and 4 deletions

4
dist/bundle.es.js vendored
View file

@ -2502,13 +2502,13 @@ function doSetSync(oldHash, newHash, data) {
function doGetSync(passedPassword, callback) { function doGetSync(passedPassword, callback) {
const password = passedPassword === null || passedPassword === undefined ? '' : passedPassword; const password = passedPassword === null || passedPassword === undefined ? '' : passedPassword;
function handleCallback() { function handleCallback(error) {
if (callback) { if (callback) {
if (typeof callback !== 'function') { if (typeof callback !== 'function') {
throw new Error('Second argument passed to "doGetSync" must be a function'); throw new Error('Second argument passed to "doGetSync" must be a function');
} }
callback(); callback(error);
} }
} }

View file

@ -80,13 +80,13 @@ export function doSetSync(oldHash, newHash, data) {
export function doGetSync(passedPassword, callback) { export function doGetSync(passedPassword, callback) {
const password = passedPassword === null || passedPassword === undefined ? '' : passedPassword; const password = passedPassword === null || passedPassword === undefined ? '' : passedPassword;
function handleCallback() { function handleCallback(error) {
if (callback) { if (callback) {
if (typeof callback !== 'function') { if (typeof callback !== 'function') {
throw new Error('Second argument passed to "doGetSync" must be a function'); throw new Error('Second argument passed to "doGetSync" must be a function');
} }
callback(); callback(error);
} }
} }