# Throw error from iOS Foreign Code, and catch it in JavaScript

**URL:** <https://forums.fusetools.com/t/throw-error-from-ios-foreign-code-and-catch-it-in-javascript/954>\
**Category:** How-to Discussions\
**Created:** [March 3, 2016, 10:50pm UTC](https://forums.fusetools.com/t/throw-error-from-ios-foreign-code-and-catch-it-in-javascript/954 "2016-03-03T22:50:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bjorn-Olav\_Strand](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/bjorn-olav_strand/32/583_2.png) [@Bjorn-Olav\_Strand](https://forums.fusetools.com/u/Bjorn-Olav_Strand)\
**Post date:** [March 3, 2016, 10:50pm UTC](https://forums.fusetools.com/t/throw-error-from-ios-foreign-code-and-catch-it-in-javascript/954/1 "2016-03-03T22:50:52Z")

</div>

If I have this JavaScript:

```auto
try {
  myJStestexception.throwit("message");
} catch (e) {
  console.log("message " + e);
}

```

How can I throw an exception from iOS foreign code?

---

<div class="post-metadata">

**Author:** ![Olle\_Fredriksson](https://avatars.discourse-cdn.com/v4/letter/o/e95f7d/32.png) [@Olle\_Fredriksson](https://forums.fusetools.com/u/Olle_Fredriksson)\
**Post date:** [March 4, 2016, 10:27am UTC](https://forums.fusetools.com/t/throw-error-from-ios-foreign-code-and-catch-it-in-javascript/954/2 "2016-03-04T10:27:46Z")

</div>

If you throw a `Fuse.Scripting.Error` in a callback from JavaScript to Uno it should be re-thrown as a JavaScript exception. To achieve this in foreign code, try calling an Uno method that does the throwing. Use something like `@{SomeClass.StaticExceptionThrower(string):Call(@"message")}` in the body of the foreign method.
