message: Bounds check should happen before
diff: @@ -16,6 +16,9 @@ static DefaultError internal_errors[] = {
  {ErrorType::INVALID, nullptr}};
  string ErrorManager::FormatExceptionRecursive(ErrorType error_type, vector<ExceptionFormatValue> &values) {
  + if (error_type >= ErrorType::ERROR_COUNT) {
  + throw InternalException("Invalid error type passed to ErrorManager::FormatError");
  + }
  auto entry = custom_errors.find(error_type);
  string error;
  if (entry == custom_errors.end()) {
  @@ -25,9 +28,6 @@ string ErrorManager::FormatExceptionRecursive(ErrorType error_type, vector<Excep
  // error was overwritten
  error = entry->second;
  }
  - if (error_type >= ErrorType::ERROR_COUNT) {
  - throw InternalException("Invalid error type passed to ErrorManager::FormatError");
  - }
  return ExceptionFormatValue::Format(error, values);
  }
  