Skip to content
Browse files
Export exception classes with default visibility
This fixes a crash caused by a `JSError` exception not being successfully caught in a different dynamic library from where it was thrown. Since the libraries were compiled with hidden symbols and loaded with `RTLD_LOCAL`, the exception typeinfo becomes unique to each module.

Reading on this subject:

Reviewed By: mhorowitz

Differential Revision: D19343161

fbshipit-source-id: 4eb3bc2576bbcca2c3aef4f52b5a27dfde214c6a
  • Loading branch information
appden authored and facebook-github-bot committed Jan 19, 2020
1 parent 475df06 commit 84adc85523770ebfee749a020920e0b216cf69f8
Showing 1 changed file with 3 additions and 3 deletions.
@@ -1191,7 +1191,7 @@ class Scope {

/// Base class for jsi exceptions
class JSIException : public std::exception {
class JSI_EXPORT JSIException : public std::exception {
JSIException(std::string what) : what_(std::move(what)){};
@@ -1207,15 +1207,15 @@ class JSIException : public std::exception {

/// This exception will be thrown by API functions on errors not related to
/// JavaScript execution.
class JSINativeException : public JSIException {
class JSI_EXPORT JSINativeException : public JSIException {
JSINativeException(std::string what) : JSIException(std::move(what)) {}

/// This exception will be thrown by API functions whenever a JS
/// operation causes an exception as described by the spec, or as
/// otherwise described.
class JSError : public JSIException {
class JSI_EXPORT JSError : public JSIException {
/// Creates a JSError referring to provided \c value
JSError(Runtime& r, Value&& value);

0 comments on commit 84adc85

Please sign in to comment.