Catch preference errors in JS