arguments.cc 763 B

1234567891011121314151617181920212223
  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 "shell/common/gin_helper/arguments.h"
  5. #include "v8/include/v8-exception.h"
  6. namespace gin_helper {
  7. void Arguments::ThrowError() const {
  8. // Gin advances |next_| counter when conversion fails while we do not, so we
  9. // have to manually advance the counter here to make gin report error with the
  10. // correct index.
  11. const_cast<Arguments*>(this)->Skip();
  12. gin::Arguments::ThrowError();
  13. }
  14. void Arguments::ThrowError(base::StringPiece message) const {
  15. isolate()->ThrowException(
  16. v8::Exception::Error(gin::StringToV8(isolate(), message)));
  17. }
  18. } // namespace gin_helper