From #839, we should 1) return the error from the formatter if it is an instance of http or rest error. 2) return internalerror if the error is not one of those 2 instances.
From #839, we should