arguments.cc 792 B

12345678910111213141516171819202122232425
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE.chromium file.
  4. #include <string_view>
  5. #include "shell/common/gin_helper/arguments.h"
  6. #include "v8/include/v8-exception.h"
  7. namespace gin_helper {
  8. void Arguments::ThrowError() const {
  9. // Gin advances |next_| counter when conversion fails while we do not, so we
  10. // have to manually advance the counter here to make gin report error with the
  11. // correct index.
  12. const_cast<Arguments*>(this)->Skip();
  13. gin::Arguments::ThrowError();
  14. }
  15. void Arguments::ThrowError(const std::string_view message) const {
  16. isolate()->ThrowException(
  17. v8::Exception::Error(gin::StringToV8(isolate(), message)));
  18. }
  19. } // namespace gin_helper