Refactored error handlinkg in API
js-beautify